Checks to see where variables are stored with address operator - C Pointer

C examples for Pointer:Address

Description

Checks to see where variables are stored with address operator

Demo Code

#include <stdio.h>

void mikado(int);                      /* declare function  */

int main(void)
{
    int pooh = 2, bah = 5;             /* local to main()   */
    /* ww w . j a  va  2 s  .  com*/
    printf("In main(), pooh = %d and &pooh = %p\n",pooh, &pooh);
    printf("In main(), bah = %d and &bah = %p\n", bah, &bah);
    mikado(pooh);

    return 0;
}

void mikado(int bah){
    int pooh = 10;                     /* local to mikado() */
    
    printf("pooh = %d and &pooh = %p\n", pooh, &pooh);

    printf("bah = %d and &bah = %p\n", bah, &bah);
}

Result


Related Tutorials