代码的输出必须为零,但我有一个错误,请指导。我可以使用其类型变量初始化结构,但是如何使用指针初始化整个结构?
#include<stdio.h>
typedef struct student
{
int roll_id[10];
int name_id[10];
int postn;
} student;
int main()
{
student p; /// here i can do student p={ {0} };
student *pptr=&p;
pptr= { {0} }; /// but can i initialize in this way ?? //error: expected
expression before ‘{’ token
pptr->roll_id[9]=1;
printf (" %d\n", pptr->postn);
return 0;
}