The output of the code has to be zero, but I am having an error, please guide. I can initialize the structure with its type variable but how can I do with the pointer to initialize the whole structure?
#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;
}
{ {0} }to a pointer.