Get addresses of strings - C String

C examples for String:char array

Description

Get addresses of strings

Demo Code

#define MSG "this is a test."

#include <stdio.h>
int main()/*w  ww . j a v  a  2 s .  c  om*/
{
    char ar[] = MSG;
    const char *pt = MSG;
    printf("address: %p \n", "test");
    printf("address ar: %p\n", ar);
    printf("address pt: %p\n", pt);
    printf("address of MSG: %p\n", MSG);
    printf("address of: %p \n", "test");

    return 0;
}

Result


Related Tutorials