4  char *min(char *a, char *b, char *c){
5  if(strcmp(a,b) > 0) && (strcmp(a,c) > 0)
6                 return a;
7  else if(strcmp(b,a) > 0) && (strcmp(b,c) > 0)
8                  return b;
9  else
10                 return c;
11 }

Code won't compile and the irony is i just did the same thing but with 2 variables and it compiled but this one wont here are the errors.

c: In function 'char* min(char*, char*, char*)':
c:5: error: expected identifier before '(' token
c:5: error: expected `;' before '(' token
c:7: error: expected identifier before '(' token
c:7: error: expected `;' before '(' token

You have extra parentheses: write this

if(strcmp(a,b) > 0) && (strcmp(a,c) > 0)

like this

if(strcmp(a,b) > 0 && strcmp(a,c) > 0)

Remarks:
⇒ Your function is not returning the correct value. Please
revise.

char *min(char *a, char *b, char *c){
if (strcmp(a,b) > 0 && strcmp(a,c) > 0)
      return a;
else if(strcmp(b,a) > 0 && strcmp(b,c) > 0)
      return b;
else
      return c;
}
inline
char* Min(char* a, char* b, char* c) {
    return
        strcmp(a,b) < 0
        ? strcmp(a,c) < 0? a: c
        : strcmp(b,c) < 0? b: c;
}

;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.