I was just wondering if anyone can help me with this problem? For some reason it won't allow me to store the input from the user into a single element of the array for example:
> Please Enter Your Full Name:
>Please Enter Your Phone Number:
> Please Enter Your Credit Card Number:
> You Have entered:
Phone Number: Jones
Credit Card Number: 3343434343
See the problem? Once it hits the space it immediately assigns the last name input to the element of the array...
I know you can simply do: scanf("%s %s", name, name);
although my code is a bit complicated where I'm using both arrays and structures which is therefore crucial to just read a single line and store it into the array.
I also tried concatenation although I need the space in between the first and last name...
Any help will be great..
Oh and heres a snippet of my code where the problem lies:
Code:printf("Enter the (First and Last) name for this record:\n"); scanf("%s", temp); strcpy(record[reccount].name, temp); // for some reason it keeps seperating the file once you hit space. printf("Enter the phone number for this record:\n"); scanf("%s", temp); strcpy(record[reccount].phoneNo, temp);