63 155
Assignments Done
99,3%
Successfully Done
In July 2018

Answer to Question #5907 in C++ for Kewal

Question #5907
Write a function that takes two char arguments and returns 0 if both the arguments are equal. The function returns -1 if the first argument is smaller than the second and 1 if the second argument is smaller than the first.
Expert's answer
int comparison(char a[], char b[]){
return -strcmp(a,b);
}

A zero value indicates that both strings are equal.
A value 1 indicates if the first character that does not match has a greater value in a than in b, and a value less than zero indicates the opposite.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions