数组和指针相关

    xiaoxiao2021-03-25  90

    char *p1 = "hello"; char *p2 = "world"; char *p3 = "a piece of cake"; char *str[] = { p1, p2, p3 }; cout << sizeof(*str[0]) << " " << typeid(str[0]).name() << " " << *(str[0] + 1) << endl;//typeid是类型 cout << sizeof(*&str[0]) << " " << typeid(&str[0]).name() << " " << *(&str[0] + 1) << endl; cout << sizeof(*str) << " " << typeid(str).name() << " " << *(str + 1) << endl; cout << sizeof(*&str) << " " << typeid(&str).name() << " " << *(&str + 1) << endl; return 0;
    转载请注明原文地址: https://ju.6miu.com/read-25906.html

    最新回复(0)