Home > Back-end >  The expression must be a pointer to a complete object types
The expression must be a pointer to a complete object types

Time:09-24

Everybody is good, should ask why this is, how
Ps expression must be a pointer to the complete object type

# include
# include

Struct student {
Int id;//student id
char name[20];//name
Char sex [3].//gender
int age;//age
};

Int main ()
{
int i;
Struct stdent * ps;
Struct student s [3]={//array initialization
{101, "zhang", 'male', 18},
{102, "bill", 'male', 19},
{103, "grandson couple", 'female' and 17}
};
for(i-0; i<3; I++)//USES the array access form
Printf (" % d % s \ \ t t t % d \ % s \ n ", (ps + I) - & gt; Id, (ps + I) - & gt; The name, (ps + I) - & gt; Sex, (ps + I) - & gt; The age);

system("pause");
return 0;
}

CodePudding user response:

# include
# include

Struct student {
Int id;//student id
char name[20];//name
Char sex [3].//gender
int age;//age
};

Int main ()
{
int i;
//struct stdent * ps;
Struct student s [3]={//array initialization
{101, "zhang", "male", 18},
{102, "bill", "male", 19},
{103, "grandson couple", "female", 17}
};
for(i-0; i<3; I++)//USES the array access form
Printf (" % d % s \ \ t t t % d \ % s \ n ", s [I] id, s [I]. Name, s [I] sex, s [I] age);

system("pause");
return 0;
}

CodePudding user response:

Hello, what is the meaning of this
1> C: \ Program Files \ MSBuild \ Microsoft (x86) Cpp \ v4.0 \ Platforms \ Win32 \ Microsoft Cpp. Win32. The Targets (147, 5) : error MSB6006: "CL. Exe" have quit, code is 2,

CodePudding user response:

The
Struct stdent * ps;
Struct student s [3]={//array initialization
{101, "zhang", 'male', 18},
{102, "bill", 'male', 19},
{103, "grandson couple", 'female' and 17}
};
Change
Struct student s [3]={//array initialization
{101, "zhang", 'male', 18},
{102, "bill", 'male', 19},
{103, "grandson couple", 'female' and 17}
};
Struct stdent * ps=s;//pointer to initialize, let it points to a memory address to use

CodePudding user response:

for(i-0; i<3; I++)==& gt;> This is wrong you I=0

CodePudding user response:

Sorry, wrong number

CodePudding user response:

In the assignment, and in defining the assignment are the problems
The expression must be a pointer to a complete object types

CodePudding user response:

C: \ Program Files \ MSBuild \ Microsoft (x86) Cpp \ v4.0 \ Platforms \ Win32 \ Microsoft Cpp. Win32. The Targets (147, 5) : error MSB6006: "CL. Exe" have quit, code is 2,
Only this one mistake

CodePudding user response:

Spelling error
Struct stdent * ps; Into a struct st u dent * ps;
  • Related