Tuesday, September 28, 2010

C++ pointer.

&variable = address

pVariable = address

*pVariable = valuje

int main(void)

{
    int a = 10;
    int*pA = &a;

    double e  = 3.14;
    double*pE = &e;

   
    printf("*pA:%d\n", *pA);
    //if I put the * infront of variable
    //it display same value of original variable
    printf("pA:%d\n",*pA);
    //value
    //this display the address of variable


    printf("&a: %d\n", &a);
    printf("pA: %d\n",pA);
    printf("*pA: %d\n",*pA);
    //this is return the valuje of
    //address

    //address  &a 주소
    //address  pA 주소
    //value *pA

    return 0;
}


No comments:

Post a Comment