Now, your latest code has many improvements. While it does compile, it does it nowhere near cleanly:
Code:
cbadboard.c:15: warning: return type defaults to `int'
cbadboard.c: In function `main':
cbadboard.c:31: warning: comparison between pointer and integer
cbadboard.c: In function `password':
cbadboard.c:88: warning: implicit declaration of function `strcmp'
cbadboard.c:96: warning: format argument is not a pointer (arg 2)
cbadboard.c:113: warning: format argument is not a pointer (arg 2)
cbadboard.c:127: warning: control reaches end of non-void function
Now, to see those errors, I had to ask for them. I use gcc, and I pass the -Wall (Warn all) switch to the compiler. As you said, you're using Apple's XCode (never heard of it before), so that doesn't apply to you. I'd look around for options to turn on extra warnings. I personally always ask gcc for all warnings, since they'll usually turn into errors.
Let's go through those one at a time.
Code:
cbadboard.c:15: warning: return type defaults to `int'
Easy one here. Really points to line 14, the definition of function main(). You declare main with no return type. Bad for any function. Change it to "int main()"
Code:
cbadboard.c:31: warning: comparison between pointer and integer
Simple mistake here. The line in question is:
Code:
if (Fpassword == 1);
You're comparing a FILE * to an integer. What you meant was to compare the return value of password(). You'll either need to store that in a variable, or move the call to password() inside the if() statement.
Code:
cbadboard.c:88: warning: implicit declaration of function `strcmp'
This warning comes from the fact that strcmp() is used before declared or defined. Since it's a standard function, obviously we'll never see the definition, so we need the declaration, which is in string.h. Add an appropriate #include <string.h> to the top of the file, and this error is no more.
Code:
cbadboard.c:96: warning: format argument is not a pointer (arg 2)
This is the big one. This is what is causing your program to crash, and this is what I pointed out back on page one. Line 96:
Code:
scanf("%i",PASSWORD);
PASSWORD is of type int. We're correctly warned here - scanf() will expect a int *, and will interpret the value of PASSWORD as that, causing a segfault. Change PASSWORD to &PASSWORD, and it will work correctly. I also recommend not calling a variable with a name in all caps, this usually indicates that the term is #define'd somewhere.
Code:
cbadboard.c:113: warning: format argument is not a pointer (arg 2)
Same as the previous error.
Code:
cbadboard.c:127: warning: control reaches end of non-void function
Another good call. If all three password attempts fail, execution can and will reach the end of the function. Then what? It's defined as returning an int, but there is no return statement. I've added a "return 1;". Also note that your return statement on line 120 doesn't match up with the other two, and is the only one that returns the correct number. (With your current setup, I'm assuming 0 to be a successful login, and 1 to be failed.)
The program will function (but not as intended) after correcting these errors. I still recommend looking into ways to split off code: there is a lot of redundancy in the password function. This will make life easier in the long run, and reduce your code. (And I suggest making a backup before making major changes.)