strcmp() string compare in C.

 

01  #include <stdio.h>
02 #include <string.h>
03
04 int main()
05
06 {
07 char s[80];
08 int i;
09 printf("Enter password : ");
10 gets(s);
11 i = strcmp(s,"access");
12 if (i==0)
13 printf("nCorrect password.");
14 else
15 printf("nIncorrect password.");
16
17 return 0;
18 }
 
 
OUTPUT :

(1st Run)

Enter password : access

Correct password.

(2nd Run)

Enter password : demo

Incorrect password.

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.