Hello everyone,
I am a newb to programming and have done a few hours of C,
I was writing this program for use as a start up program in Terminal but i got the error message Expected expression before else, when compiling in Xcode,
i had an "if" statement before and there are curly braces at the end of the "if" statement,
any help would be greatly appreciated, thanks!
I am a newb to programming and have done a few hours of C,
I was writing this program for use as a start up program in Terminal but i got the error message Expected expression before else, when compiling in Xcode,
i had an "if" statement before and there are curly braces at the end of the "if" statement,
Code:
#include <stdio.h>
void Hello( void );
void Failed( void );
int main (int argc, const char * argv[]) {
char pass1, pass2, pass3;
Hello();
scanf("%c,%c,%c", &pass1, &pass2, &pass3);
getchar();
if (&pass1 == "p", &pass2 == "w", &pass3 == "d");
{
printf("Continue!\n");
}
else {
Failed();
}
}
void Hello( void ) {
printf("Welcome to Unix!\n");
getchar();
printf("Password?\n");
}
void Failed( void ) {
int inf1;
inf1 = 1;
printf("Leave now.");
while (inf1 > 2) {
printf("Leave now.");
}
}
any help would be greatly appreciated, thanks!