what does struct variable contain when not used with .
operator?
Conisder below program
#include<stdio.h>
typedef struct{
char a;
int b;
} scratch;
int main(){
scratch s1 = {2,4};
printf("%p",s1); o/p 000566000
printf(" %p",&s1); o/p 00000420
printf(" %p",&s1.a); o/p 00000420
return 0;
}
sturct variable s1
and its first member s1.a
both return the same address when used with &
but s1
returns some other value. is this garbage or what ?
what does struct s1 contain? (when I do this with oops language, object variable prints some address as far as concerned to java and there is no address operator in java).
Could anyone clear me what s1 is doing here? or simply a compiler issue?