Original Post
I give these codes:
#include<stdio.h>
struct a
{
int b;
char c;
};
struct d
{
int id;
struct a xx[2];
};
void main(void)
{
struct d* structptr;
struct d example;
structptr=&example
structptr->id=1;
structptr->xx[0]={2,'x'};/*error here*/
structptr->xx[1]={3,'y'};/*error here*/
/*if I use these codes ,it will have no error:
structptr->xx[0].b=2;
structptr->xx[0].c='x';
*/
printf("%d,%d,%c",structptr->id,structptr->xx[0].b,structptr->xx[0].c);
}
My compiler is Turbo C,why did it happen?