小编EmJ*_*Jov的帖子

如何在2D char数组中打印[x] [y]元素的地址?(C++)

char arr[2][6] = { "hello", "foo" };

cout << arr[0] << " or " << *(arr) << endl;// prints "hello"
cout << arr[1] << " or " << *(arr + 1) << endl; // prints "foo"

cout << arr << endl; // prints an address of "hello" (and 'h')
cout << arr + 1 << endl; //prints an address of "foo" (and 'f')

cout << arr[0][1] << endl; // prints 'e'
cout << &arr[0][1] << endl; // prints "ello"
Run Code Online (Sandbox Code Playgroud)

所以,我想在"你好"中打印一个"e"的地址.我怎么做? …

c++ arrays char

3
推荐指数
1
解决办法
100
查看次数

标签 统计

arrays ×1

c++ ×1

char ×1