#include <stdio.h>
int main(){
char arr[] = "HelloWorld";
printf("%s\n", arr+3); //first line
printf("%s\n", &arr[4]); //second line
return 0;
}
任何人都可以向我解释以下内容吗?打印数组字符串的方法
1)为什么第一行输出= loWorld?
2)为什么第二行的输出= oWorld?
3)为什么需要把&放在第二行?
你知道指针算法和数组指针转换? – haccks
这在第一章的所有C书中都有介绍 - 为什么不读它? –
是的,这是简单的指针算术。阅读指针和数组如何工作。 – Raman