关于指针、指针的指针与地址

/*

**test17.cpp : Defines the entry point for the console application.

**系统winXP SP3 32位.

**关于指针

*/


#include "stdafx.h"

#include "stdio.h"

#include "iostream.h"


int main(int argc, char* argv[])

{

    int iNum = 0;

    char cNum = 'a';

    float fNum = iNum;

    double dNum = fNum;

    bool bNum = true;

    int* piNum = &iNum;

    int** ppiNum = &piNum;

    cout<<"address iNum is: "<<&iNum<

    printf("address cNum is: 0x%p\n",cNum);   //0x00000061

    cout<<"address fNum is: "<<&fNum<

    cout<<"address dNum is: "<<&dNum<

    cout<<"address bNum is: "<<&bNum<

    cout<<"value piNum is: "<

    cout<<"address piNum is: "<<&piNum<

    cout<<"value ppiNum is: "<

    cout<<"address ppiNum is: "<<&ppiNum<


    return 0;

}


Tips1:上例我们可以看出指针的值是32bit的正整数,指针piNum的值就是iNum的地址0x0012FF7C,同理ppiNum的值就是指针piNum的地址0x0012FF64。

你可能感兴趣的:(关于指针、指针的指针与地址)