У вашего кода довольно много проблем.Смотрите мои встроенные комментарии для версии, которая компилирует и, по-видимому, делает то, что вы хотите, более разумным способом.
#include <stdio.h>
#include <stdlib.h> /* for _Exit() */
#include <string.h> /* for strcspn() */
/* #include <curses.h> you don't need curses for such a simple program */
/* #include <signal.h> this header is not needed */
#define WAIT 3
#define INCORRECT "Incorrect input\n"
#define FILENAME "testfile"
void stop(void); /* match the new prototype */
int main(void) /* main() always returns int, use void if not using argc/argv */
{
char first[10], last[10];
/* int i; You never use this */
FILE *fp; /* You don't need *fopen() here */
/* initscr(); */
/* noecho(); */
printf("Enter first name: "); /* Added by me */
fgets(first, sizeof(first), stdin); /* Don't use scanf, fgets prevents overflows */
first[strcspn(first,"\n")] = '\0'; /* chomp the newline if it exists */
printf("Enter last name: "); /* Added by me */
fgets(last, sizeof(last), stdin); /* Don't use scanf, fgets prevents overflows */
last[strcspn(last,"\n")] = '\0'; /* chomp the newline if it exists */
/* echo(); */
sleep(WAIT);
if((fp = fopen(FILENAME, "a")) != NULL){
fprintf(fp, "First: %s Last: %s\n", first, last);
fclose(fp);
stop(); /* You never call this, i'm guessing you want it here */
}
printf(INCORRECT); /* only called if fopen() fails */
/* endwin(); */
return 0; /* mandatory return for main() */
}
void stop(void) /* Use 'void' if the func takes no params and returns nothing */
{
/* endwin(); */
_Exit(0); /* _Exit is apart of C99 */
}