#include <stdio.h> /* including standard library */ //#include <windows.h> /* uncomment this for Windows */ return value;
returns a value
#include <stdio.h> /* including standard library */ //#include <windows.h> /* uncomment this for Windows */ #include <stdlib.h> #include <string.h> int yesno( char value1[], char value2[] ){ if ( strcmp( value1, value2 ) == 0) { return 0; } else { return 1; } } int main(void) { char str1[]="ADS"; char str2[]="FJK"; if ( yesno( str1, str1 ) == 0 ) { printf("same\n"); } else { printf("different\n"); } if ( yesno( str2, str2 ) == 1 ) { printf("different\n"); } else { printf("same\n"); } if ( yesno( str1, str2 ) == 0 ) { printf("same\n"); } else { printf("different\n"); } return 0; }
output: same same different