close

#include<iostream>
#include<stdio.h>
#include<conio.h>
using namespace std;
int main()
{
char str[] = "Hello";
char* p=str;
int n=270;
int m;
printf("%x\n",p);
//%d:2358624(10進位) = %x:23fd60(16進位)
printf("%d %d %d %d\n",sizeof(str), sizeof(p), sizeof(n), sizeof(m));
//Ans:6 8 4 4

//因此可知sizeof()函數會考慮字串結束字元 '\0' , 指標地址竟然是8 byte!
getch();
return 0;

}

arrow
arrow
    全站熱搜

    大玩家闖天涯 發表在 痞客邦 留言(0) 人氣()