ALEXKK2011

The Technical Side of alexKK2011
  博客园  :: 新随笔  :: 订阅 订阅  :: 管理

char type and its pointer (2)

Posted on 2011-02-22 15:28  alexkk2011  阅读(123)  评论(0编辑  收藏  举报
#include <iostream>
#include <string>

using namespace std;

void main()
{
    //exp.3
    char *charPtr;    //if this printer is not initialized, when it is used, 
                    //run-time check failure#3- the variable 'charPtr' is being used without being initialized.
    cout << "char *charPtr without asignment" << endl;
    cout << "sizeof(charPtr) is : " << sizeof(charPtr) << endl;
    cout << "sizeof(*charPtr) is : " << sizeof(*charPtr) << endl << endl;
    /*
    char *charPtr without asignment
    sizeof(charPtr) is : 4
    sizeof(*charPtr) is : 1

    请按任意键继续. . .
    */
}