Given the char * variables name1, name2, and name3, write a fragment of code that assigns the largest value to the variable max (assume all three have already been declared and have been assigned values).
.
.
Click on the title for the solution
.
.
max=name1;
if (strcmp(name2, max)>0)
max=name2;
if (strcmp(name3,max)>0)
max=name3;
.
Click on the title for the solution
.
.
This is the answer:
:
max=name1;
if (strcmp(name2, max)>0)
max=name2;
if (strcmp(name3,max)>0)
max=name3;
Comments
Post a Comment