占用空间的大小
void main()
{
char s[]="Welcometohengtian";
printf("%s%d\n",(s+7),sizeof(s));
char s[20]="Welcometohengtian";
printf("%s%d\n",(s+7),sizeof(s));
int a=4;
printf("%d\n",sizeof(int));
char *p="renyuan";
printf("%d\n",sizeof(p));
int b[5]={0};
printf("%d\n",sizeof(b));
}
输出的结果是:tohengtian18
tohengtian20
4
4
20
void main()
{
char s[20]="Welcometohengtian";
printf("%s%d\n",(s+7),sizeof(s));
}
输出的结果是:tohengtian20
public class Test9 {
public static void main(String[] args) {
String hello="hello";
String hel="hel";
String lo="lo";
System.out.println(hello=="hel"+"lo"); ///true????????????
System.out.println(hello=="hel"+lo);
}
}
输出的结果是:true false