When attempting to assign a character string to the previously defined
char flightNumber[MAX]
error: assignment makes integer from pointer without a cast [-Werror]
char
int
flightNumber[MAX]
main()
flightMenu();
scanf( "%d", &choice );
while ( choice < 1 || choice > 3 ) {
printf( "That is not a valid flight option!" );
flightMenu();
scanf( "%d", &choice );
}
char name[MAX];
char flightNumber[MAX];
printf( "Enter your first name: ");
scanf( "%s", &name[MAX] );
if ( choice == 1 ) {
flightNumber[MAX] = "MIA1050";
seatReservation( flight1 );
}
else if ( choice == 2 ) {
flightNumber[MAX] = "BNA1050";
seatReservation( flight2 );
}
else if ( choice == 3 ) {
flightNumber[MAX] = "LAS1050";
seatReservation( flight3 );
}
strcpy
To copy a string you should use special function like:
#include <stdio.h>
#include <string.h>
int main()
{
char source[1000], destination[1000];
printf("Input a string\n");
gets(source);
strcpy(destination, source);
printf("Source string: \"%s\"\n", source);
printf("Destination string: \"%s\"\n", destination);
return 0;
}
http://www.programmingsimplified.com/c/source-code/c-program-copy-strings