Address difference between two integer variables in c

前端 未结 5 1188
醉梦人生
醉梦人生 2021-01-07 07:17
#include 
int main()
{
    int i=10,j=20,diff;
    diff=&j-&i;
    printf(\"\\nAddress of i=%u Address of j=%u\",&i,&j);
    printf(\"         


        
5条回答
  •  礼貌的吻别
    2021-01-07 07:37

    When an 2 integer variables are declared its not necessary for the second variable to occupy the next four bytes of the address occupied by the first variable?

    NO, The address can be anywhere, the compiler chosses, unless ofcourse you have an array.

提交回复
热议问题