Hi,
I'm trying to get this programme to work but I can't get it to
output the string data at the end of the line.I have copied and pasted the line in question below but it may be a prob with the prog further down.
It reads character input ok but doesn't put one string into another
or recognize when a string is quoted in a printf.
Code:
printf("%s what is your second name? \n", surname, name2, name);
#include <stdio.h>
int main ()
{
char name[20];
char name2[40];
char surname[120];
printf("What is your first name?");
scanf("%s", &name);
fflush(stdin);
strcpy(name2, name);
printf("%s what is your second name? \n");
scanf("%s", &name2);
strcat(surname, name2);
strcpy(surname, name2);
fflush(stdin);
printf("%s what is your second name? \n", surname, name2, name);
}