We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I faced the wired situation. I have two questions.
I declared the global variable of structure array type as below. A_TYPE gstXXXX[16];
Then, two functions wanted to look for the address of gstXXXX[1].
Q1) At first function, the address of gstXXX[1] was &gstXXX[0]+1464. But other funtion calculated the address of gstXXX[1] was &gstXXX[0]+1480.
Q2) I declared three structures by the same type. typedef struct A { } typedef struct B { } typedef struct C { }
But the result of sizeof them are different. sizeof(A)=124, sizeof(B)=140, sizeof(C)=124
What happened? I cannot understand them.
Please let me know something, if u have ever experienced this problem.
So the definitions of your A_TYPE data structure seen by those two functions are different.
I declared three structures by the same type. typedef struct A { } typedef struct B { } typedef struct C { }
No, you didn't, because none of those is a declaration of any type. They're all syntax errors.
What happened?
It's really quite obvious: despite your statement, they're not the same type. You made it impossible to find out what the difference actually is by stripping out all the details. Come back here with a reproducible example, and odds are people will be able to point you to the exact difference.
typedef struct A { }; typedef struct B { }; typedef struct C { };
if i declare like dis what may b d space allocated by the compiler for each structure.
does this vary 4m compiler 2 compiler
3
yes
know wate, knot 3. d # z prbly klozr 2 17
Dan Henry, you're a devil :-)
The language is an offshoot of Indlish that I call 'Tardish.