hmm..i'm doing something like a simple registration.. the user will input the information being asked, then those info will be stored into an array..are spaces not allowed to be stored in an array..?

well, i can't explain the problem that much.. here's my simple code:

#include <stdio.h>
int i;
char Lname[15],Fname[15],Mname[15],sex[2];

main()
{     
      printf("\n        Simple Registration System        \n");
      for (i=1;i<=80;i++)
          { printf("_"); }

      printf("Please provide all the information needed.");
      printf("\nLast Name: ");
         scanf("%s",&Lname);
      printf("\nFirst Name: ");
         scanf("%s",&Fname); 
      printf("\nMiddle Name: ");
         scanf("%s",&Mname); 
      printf("\nSex (M/F): ");
         scanf("%s",&sex);
      printf("\n\nWelcome Mr./Ms. %s %c. %s !",Fname,Mname[0],Lname);  



getch();      
}      

if the user's first name, for example is anna marie, the program won't be storing the second name into &Fname, instead, it'll be stored on &Mname...

Fname would now be holding anna, then &Mname will have marie as its value

That's because scanf() stops reading at spaces. You'll have to use something like fgets() or a complex/convoluted format specifier in scanf().

oh, thank you for that.. can i ask for a sample code.. i would appreciate it so much.. thank you

It's your job to write the code. I gave you most of what you need. You need to do the rest.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.