Skip to content
Permalink
040c0c153e
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
32 lines (23 sloc) 535 Bytes
#include <stdio.h>
#include <string.h>
#define BUFFSIZE 30
int checkPassword(char *buffer){
char passText[] = "ALongerString";
passText[7] = '\0';
int out = strcmp(passText, buffer);
return out;
}
void main(void){
char buffer[BUFFSIZE];
printf("Enter Password> ");
fgets(buffer, BUFFSIZE, stdin);
//Remove the Newlines
buffer[strcspn(buffer, "\r\n")] = 0;
//Get the Length
int returnVal = checkPassword(buffer);
if (returnVal == 0){
printf("Win!!\n");
}
else
printf("Lose\n");
}