#include <iostream> int main(int argc, char *argv[]) { char str[] = "game"; std::cout<<sizeof(str)<<":"; char *p = str; std::cout<<sizeof(p)<<":"; char i = 10; std::cout<<sizeof(i)<<":"; void *pp = malloc(10); std::cout<<sizeof(pp)<<":"; free(pp); char a[100] = {'a','b',0};//0为'/0'的ASCII码,作为结束符 std::cout<<sizeof(a)<<":"<<strlen(a)<<std::endl; } 输出结果为: 5:4:1:4:100:2