??????C?????У???????????????????????????????????????????????????????????????????У?????????????????????????????
???????
????????????????????????
????int i=2;
????int *p;
????p=&i;
???????????????????????????÷???????????????????????????????????????????????????????????????????????????????????p?б?????????????i?????????
??????????????ζ??????????????????????????????????????????????????????壺?磺int p????????????????????????????????????????????????????&?????????????????????????????????&????λ???????????&&???????????????
?????????????????У?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????void?????????????????κ?????????????????????????????????????磬int ?????????????char ??????????
??????????????????????????????????????????
#include<stdio.h>
void main()
{
int a??b??c??*p;
a=1;
b=3;
p=&a;
b=*p+1;
c=*(p+1);
printf("%d %d %d %d /n"??a??b??c??*p+3);
}
???????н????? 1 2 -858993460 4
???????????????????????????????????????£???????????????????Visual Studio ?????????????????????????????????дC???????????C???????徳??????ο??????
???????????????У???????????????????b=p+1;??c=(p+1);?????????p???????????????1?????b??????b=a+1;????????p?????????1????p+1?????????????c?????????????p??????????????????????????????????????????????????Σ?????м?????ò???????????????
????????
????????????????????????????????
????int a[4]={2??4??5??9};
??????????????4??????С??????????a?????????????????
??????????????????ο?????????????????????????????????????????á?
???????????????????????????
#include<stdio.h>
void main()
{
int a[4]={2??4??5??9};
int *p;
p=a;
*p=*p++;
printf("%d %d %d/n"??*p??*p+6??*(p+1));
}
???????н????4 10 5
?????????????p=a;?????????a???0???????????????p????????a???????????a???0??????????
????a[i]???????a???i???????????????????p????????p=&a[0];???????????p???????a???0??????????p???????????a[0]???????????p+1????????????????a[1]???????p+i?????????a[i]????????p+i????????????????a[i]????????????????a[i]???????????д??(a+i)??????ó??????&a[i]??a+i??????????p[i]??p+i?????????
??????????????????????????????????????????????????????????????????????????????????????????p=a??p++????????????????????????????????????a=p??a++???????????????
??????????????????????????strlen(char *s):
int strlen(char *s)
{
int n;
for(n=0;*s!='/0';s++)
n++;
return n;
}
???????s????????????????????????????????????s++?????????strlen????????????е????????????????????strlen?????е???и?????????????????????????У????????char s[]??char *s??????
????????????????μ?????????????p???????????????????????????p++????p??????????????????????????p+=i????p???м?i???????????????????p????????????????i??????????????????????????????????г?????????????????????????????????0??????????????????????????????????????????????????????????????????????????????κ??????0??????????????????????????塣??????????????????????????????????????????塣?????????????????????????????p+n??????p??????????????n??????????????????p?????????????????????????????????????p+n???n??????p???????????????????????p??????????????????p???????????磬???int?????4??????洢????????int?????????ж????n????4???????????
?????????????????????????????p??q???????????е???????p<q?????q-p+1??λ??p??q???????????????????????????????strlen(char *s)????????汾??
int strlen(char *s)
{
char *p=s;
while(*p!='/0')
p++;
return p-s;
}
?????????У?p???????????s????????????????????????while?????佫???μ????????е???????????????????????????β?????’/0’????????p????????????????????????p++??p???????????????????p-s????????????????????????????????
?????????Ч?????????????????????????????????????????????????????????????????????????????????????????????0???????0?????????????????????????????????????
?????????????????
????char a[]=”I am a boy”; char *p=”I am a boy”;
????a????????????????????????????????’/0’???????顣?????е????????????????????a???????????洢λ?á???p??????????????????????????????????????????????????????????????????????????????????????ж?????
???????????????????????????????????????????????
????void strcpy(char *s??char *t)
????{
????int i;
????i=0;
????while((s[i]=t[i])!='/0')
????i++;
????}
?????????????????????????????strcpy?????п??????κη????ò???s??t??
?????????????????????汾??
????void strcpy(char *s??char *t)
????{
????while((*s=*t)!='/0'){
????s++;
????t++;
????}
????}
??????汾??
????void strcpy(char *s??char *t)
????{
????while(*s++=*t++)
????;
????}
????????s??t??????????????????????????С?????*t++??????????????????t???????????????????++??????????????????t????????????s?????????????????????洢???????s?????λ?á??????汾?б????’/0’???????????????????ж???????????0???ɡ?