Wish you a Good Day,
In the following code :
struct mystruct {
    char a;
    int b;
    short c;
    char d;
};

int main(int argc, char *argv[])
{
    
    char ch;
    int i;
    struct mystruct foo[3];

    printf("&foo[0]=%p\t&foo[1]=%p\t&foo[2]=%p\t&ch=%p\t&i=%p\n",   \
    &foo[0], &foo[1], &foo[2], &ch, &i);


  system("PAUSE");    
  return 0;
}


The output was :
&foo[0]=0022FF30
&foo[1]=0022FF3C
&foo[2]=0022FF48
&ch=0022FF6F
&i=0022FF68


Now my doubt is, char ch and int i being declared earlier to struct mystruct 
foo[3] are assigned lower memory location compared to the array of structures. 
Why does it happen like this ?

With Regards,
Debasish












      Download prohibited? No problem. CHAT from any browser, without download. 
Go to http://in.messenger.yahoo.com/webmessengerpromo.php/

[Non-text portions of this message have been removed]

Reply via email to