equal string c

[ad_1]

equal string c
#include 
// strcmp is a function from the stadard string library that returns 0 of both strings are equals

int main () {

	// for exemple
	char[] str1 = "Hey!";
  	char[] str2 = "Hey!";
  	char[] str3 = "Hola";

  	// instead of "if (str1 == srt2)" you'll need to use
  	if (strcmp(str1, str2) == 0)
        printf("str1 = str2\n");

  	if (strcmp(str1, str3) != 0)
        printf("str1 != str2\n");

	return 0;
}

[ad_2]

Please follow and like us:
Content Protection by DMCA.com