69,371
社区成员
发帖
与我相关
我的任务
分享
#include "stdio.h"
#include "stdlib.h"
typedef struct
{
int id;
int eng;
int math;
int sum;
int avg;
}student;
int main(void)
{
student *pstu;
student stu[50];
int i;
pstu = stu;
for (i = 0; i < 3; i++)
{
scanf("%d",&pstu[i]->id);//*这段代码有问题
}
#include <iostream>
using namespace std;
struct point
{
int x;
int y; //包含两个变量成员
};
void main()
{
point pt;
point *p;
pt.x=1;
pt.y=2;
cout<<pt.x<<endl<<pt.y<<endl;//不能用“->”
cout<<p->x<<endl<<p->y<<endl;//不能用“.”
}
这是结构体的,类也是一样的。
这是我百度的,楼主可以参考学习~~~~scanf("%d",(&pstu[i])->id);
注意优先级