strncmp() compare & chars in C.

 

01  #include<stdio.h>
02 #include<string.h>
03
04 int main()
05 {
06 char str1[20]="multicolor";
07 char str2[20]="multinational";
08 int i;
09
10 i=strncmp(str1,str2,5);
11 if(i==0)
12 {
13 printf("Strings are equal");
14 }
15 else
16 {
17 printf("Strings are not equal");
18 }
19 return 0;
20 }
 
 OUTPUT :

Strings are equal

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.