Ok im writing a little program to get practice, its going to be an email whitelist thing, you can either add a email to the list or check if a email is in the list. Anyway im testing out what ive written so far and im getting an errror " [Linker error] undefined reference to `addemail' ". Cant see what ive done wrong anyway, heres my code.
Code:#include <stdio.h> void addemail(); main() { int choice; printf("Email whitelist"); printf("(a) to add email, (c) to check email against list, (e) to exit.\n"); printf("Choice: "); choice = -1; while (choice == -1) { choice=getchar(); } switch (choice) { case 'a': addemail(); break; case 'c': /* checkemail(); */ break; case 'e': break; default: printf("Invalid Choice."); break; } void addemail(); { char buf[40]; FILE *fp; printf("Enter email: "); fgets(buf, sizeof(buf), stdin); fp = fopen("emails","a+"); fputs(buf,fp); fclose(fp); printf("\nEmail address %s added.",buf); } }



LinkBack URL
About LinkBacks


