# include & lt; The malloc. H>
Struct staticlink {
The int data;
Int cur;
};
Typedef struct staticlink * link;
Typedef struct staticlink component;
Void Initlink (link link2) {
int i=0;
for(i=0; i<9. I++) {
If (I==0) {
Link2 [I]. Cur=I + 1;
} else {
The scanf (" % d ", & amp; Link2 [I]. Data);
Link2 [I]. Cur=I + 1;
Printf (" % d \ n ", I);
}
}
Link2 [9]. data=https://bbs.csdn.net/topics/10;
Link2 [9]. Cur=0;
return;
}
Int main () {
The link link2=(link) malloc (10 * sizeof (link));
Initlink (link2);
return 0;
}
Enter the eighth value error don't know why the address didn't cross!! Direct error why the great god
CodePudding user response:
Whether the cause of the compilerCodePudding user response:
The inside of the sizeof USES the wrong typeCodePudding user response:
Should be the sizeof (component)CodePudding user response:
I said that I wrong,,,, no wonder,,, thanksCodePudding user response:
Pointer to a 32-bit system is 4 bytes,