指针的问题
# include<stdio.h>void main()
{
char str[][10] = {"China","Beijing"},*p = str;
printf("%s\n",p + 10);
}
请问高手哪里错了~~~~~我想要的答案是Beijing
VC++里的报错资料如下:
--------------------Configuration: 69 - Win32 Debug--------------------
Compiling...
9.cpp
D:\Microsoft Visual Studio\MyProjects\69\9.cpp(5) : error C2440: 'initializing' : cannot convert from 'char [2][10]' to 'char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
D:\Microsoft Visual Studio\MyProjects\69\9.cpp(6) : error C2065: 'printf' : undeclared identifier
执行 cl.exe 时出错.
69.exe - 1 error(s), 0 warning(s)
[ 本帖最后由 adsl520 于 2010-3-15 20:02 编辑 ]