字符串赋值 数组与指针的区别

char *test_str = "This is a test string";

// test_str是指针类型,sizeof(test_str) = 8

char test_str[] = "This is a test string";

// test_str是数组类型,sizeof(test_str) = 22

posted @ 2016-10-01 11:17  hunterDing  阅读(211)  评论(0编辑  收藏  举报