本帖最后由 bin554385863 于 2019-10-20 01:46 编辑
这是一个含有三个元素为指针的数组,每个指针又指向一个字符串
相当于:#include <iostream>
int main(int argc, char const *argv[])
{
char str[3][4] = {"qwe","rty","uio"};
char *p[3];
for (size_t i = 0; i < 3; i++)
{
p[i] = (char*)&str[i];
std::cout<<"p["<<i<<"] = "<<*(p+i)<<std::endl;
}
return 0;
}
---------------------------------------------------------------------------------
Microsoft Windows [版本 10.0.16299.1087]
(c) 2017 Microsoft Corporation。保留所有权利。
E:\Users\86184\Documents\Code>c:\Users\86184\.vscode\extensions\ms-vscode.cpptools-0.26.0\debugAdapters\bin\WindowsDebugLauncher.exe --stdin=Microsoft-MIEngine-In-tbdkvgpp.qyd --stdout=Microsoft-MIEngine-Out-aaz51oxl.xmu --stderr=Microsoft-MIEngine-Error-ihypjwgz.ucr --pid=Microsoft-MIEngine-Pid-qnrxlby4.21c "--dbgExe=E:\My Program\MinGW\bin\gdb.exe" --interpreter=mi
p[0] = qwe
p[1] = rty
p[2] = uio
E:\Users\86184\Documents\Code> |