compare two string using strncmp

 /*  if sanme then 0 and if not same then  non zero*/
#include <stdio.h>
#include <string.h>
int main()
{
    printf("Enter your name\n");
    char *c[9] ;
    scanf("%s" , c);
 int result;
 result = strncmp(c , "Rohit sharma" , 5);
    printf("%d" , result);
    return 0;
}
x

Comments

Popular posts from this blog

Factors : using C

Cross shaped pattern

Factorial ! calculation