Program error. please advise

Source: Internet
Author: User
Program error. For more information, see Linux general technology-Linux programming and kernel. # Include "stdio. h"
# Include "stdlib. h"
# Include "ctype. h"
Struct co
{
Int index;
Char name [8];
Char MTel [12];
Char Tel [12];

};
Int x;
Int main ()
{
Struct co * p;
Char ch;
Printf ("do you add a user? Y/N \ n ");
Ch = getchar ();
If (ch = 'y' | ch = 'y ')
{
P = (struct co *) malloc (sizeof (struct co); // dynamically allocate a bucket
P-> index = ++ x;
Printf ("User name :");
Scanf ("% s", p-> name );
Printf ("MoveTel :");
Scanf ("% s", p-> MTel );
Printf ("Tel :");
Scanf ("% s", p-> Tel );
Printf ("intex: % d \ nname: % s \ nMoveTel: % s \ nHomeTel: % s \ n", p-> index, p-name, p-> MTel, p-> Tel );

}
Printf ("page size = % d \ n", getpagesize (); // Obtain the memory category size
}


Error message
[Yh1 @ lzf 3] $ gcc-o 3-10 3-10.c
3-10.c: In the 'main' function:
3-10.c: 29: 67: Error: 'name' is not declared (used for the first time in this function)
3-10.c: 29: 67: Note: Each undeclared identifier is reported only once in the function it appears.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.