I want to create a function equivalent to the function strcmp available with # include <string.h>.
Code:
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
char comparison (ch, cha);
int main (int argc, char * argv [])
(
char string1 [10], string2 [10];
printf ( "Enter two words in validating one after the other, below: \ n");
scanf ( "% 10s% 10s", string1, string2);
printf ( "You took the words% s and% s \ n", string1, string2);
compare (string1, string2);
/ / Function comparison
char comparison (ch, cha)
(
if (ch == CHAINED)
(
printf ( "comparing:% s and% s are identical \ n", ch, cha);
)
else
(
printf ( "comparing:% s and% s are different \ n", ch, cha);
)
)
Outside, if I compare two strings of similar nature, the program reports me as different. Can you tell me where is the mistake?
Bookmarks