Hey guys... I am currently taking a C progarmming class, and I've been unable to contact my instructor and I've reached a little snag in code
It seems as though this program randomly crashes. I can't input any hyphens or anything more than about 50 characters without it crasahing. Its terribly confusing, and I have no idea why it isn't working.
Edit: Also the program ends prematurely if I enter long text for the two previous strings.
Here it is:
Code:
//This program accepts input a greeting, name and email and then displays
// that information to the user.
#include <stdio.h>
int main(void)
{
char inEmail[500];
char inName[500];
char inMessage[150];
char exitKey;
printf("Enter a greeting message: ");
gets(inMessage);
printf("Enter a name please: ");
scanf("%s",&inName);
printf("Enter your email address: ");
scanf("%s",&inEmail);
printf("%s\n",inMessage);
printf("Your name is %s\n",inName);
printf("Your email address is %s\n",inEmail);
printf("Press return to exit program:");
scanf("%c",&exitKey);
getchar();
return 0;
}