指针

第一题:用指针在函数里面交换两个数的值

void func(int *a, int *b)

第二题:试说明一下声明语句的区别

char * const p;
char const * p;
char const * const p;
const char * const p

第三题:试说明下面程序的运行结果

char str1[] = "abc";
char str2[] = "abc";
const char str3[] = "abc";
const char str4[] = "abc";
const char *str5 = "abc";
const char *str6 = "abc";
char *str7 = "abc";
char *str8 = "abc";
cout << ( str1 == str2 ) << endl;
cout << ( str3 == str4 ) << endl;
cout << ( str5 == str6 ) << endl;
cout << ( str7 == str8 ) << endl;
posted @ 2017-11-06 08:15  __迷途的羔羊  阅读(121)  评论(0编辑  收藏  举报