Why I initialise a struct in this way make my phone crashed?
I defined a struct:
typedef struct myStruct{
int32 iMem1;
int16 sMem2;
int32 iMem3;
}myStruct;
And initialise it:
void main(){
myStruct s1 = {0, 1, 0};
return 0;
}
When I run it in my phone, it crashed my phone.
If I initialise it another way:
void main(){
myStruct s1 = {0};
return 0;
}
Everything is ok!
I doub开发者_Python百科t about it!
Both struct initializations are fine, assuming int32
and int16
are types. However, main
must return an int:
int main()
精彩评论