Just starting to learn C/C++ in my CS 221 class.
Here's the start of my code:
int main()
{
int id;
char name[100];
double wages;
printf("Enter employee's id: ");
scanf("%4i", id);
printf("Enter employee's full name: ");
scanf("%99[^\n]",name);
printf("Enter gross salary for %s :",name);
return 0;
}
Having trouble wrapping my head around char arrays, stdin and buffers in c. Why does the above code skip the user imputing a name? do I need fflush in there? couldn't really get that to work either.