#include<心得>
main()
{
view *有求于人;
if(真的做不到)
{
point *怎么办?
怎么办?=&可以去找比自己犀利的人寻求;
}
else(做的到&&但是自己不想努力去做)
{
result *怎么办?
怎么办?=&悲剧;
}
有求于人=怎么办;
printf(“有求于人=%chinese”,有求于人);
}
人生道路慢慢曲折,想得到稳定的发展和提高,要时刻思考,如果他不在我身边怎么办,多多去寻找自己解决问题的途径。指针在传递过程,是全传递,而实参传递是部分传递。
#include<stdio.h>
main()
{
int a,b;
int*p1,*p2;
a=1;b=3;
// scanf("%d,%d",&a,&b);
p1=&a;p2=&b;
if(a<b)
swap(p1,p2);
printf("\n%d,%d\n",a,b);
}
swap(int *pa,int *pb)
{
int p;
p=*pa;
*pa=*pb;
*pb=p;
}
--------------------------------------------------------------
笔记2:指针函数
#include<stdio.h>
main()
{
int a,b,c;
int max(a,b);
int (*p)(a,b);
p=&max;
scanf("%d%d",&a,&b);
c=(*p)(a,b);
printf("max=%d\n",c);
while(1);
}
max(a,b)
{
if(a>b)
{
return a;
}
else
{
return b;
}
}
-------------------------------------------------------------------------------------------------
笔记3:多维数组乃一维之嵌套。
笔记4:结构体指针。
main()
{ struct student
{ long int num;
char name[20];
char ***;
float score;
}stu_1,*p;
p=&stu_1;
stu_1.num=89757;
strcpy(stu_1.name,"Li Lin");
p->***=‘M‘;
p->score=89.5;
printf("\nNo:%ld\nname:%s\n***:%c\nscore:%f\n",
(*p).num , p->name , stu_1.*** , p->score );
}
笔记5:较难理解的部分,结构化指针整体使用
#include<stdio.h>
struct complex add(struct complex,struct complex);
struct complex
{
double re;//实部
double im;//虚部
};
struct complex add(struct complex a,struct complex b)
{
struct complex c;
c.re=a.re+b.re;
c.im=a.im+b.im;
return c;
}
int main()
{
struct complex x={6.5,8.9},y={7.1,9.4};
struct complex z;
z=add(x,y);
printf("和为:%5.2lf+i%5.2lf\n",z.re,z.im);
}
/*#include<stdio.h>
struct student
{
int num;
char *name;
char ***;
float score;
}stu={1,"张宾",'F',55},*pstu;
int main()
{
pstu=&stu;
printf("学号:%d 姓名:%s\n",stu.num,stu.name);
printf("性别:%c 成绩:%5.2f\n\n",stu.***,stu.score);
printf("学号:%d 姓名:%s\n",(*pstu).num,(*pstu).name);
printf("性别:%c 成绩:%5.2f\n\n",(*pstu).***,(*pstu).score);
printf("学号:%d 姓名:%s\n",pstu->num,pstu->name);
printf("性别:%c 成绩:%5.2f\n\n",pstu->***,pstu->score);
while(1);
}
*/