上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页

2018年6月28日

摘要: 1 //链表的学习 2 #include 3 #include 4 #define LEN sizeof(struct student) 5 struct student{ 6 int num; 7 float score; 8 struct student *next; 9 }; 10 int n;//这个是链表节点的个数 11 ... 阅读全文
posted @ 2018-06-28 11:38 孙悟空son_ku_kong 阅读(147) 评论(0) 推荐(0) 编辑
摘要: //指向指针的结构体 #include struct student{ int num; char name[20]; }student1={1001,"xiaoming"}; int main(){ struct student *p; p=&student1; printf("学生的号数\t学生的名字\t\n"); printf("%d\t%... 阅读全文
posted @ 2018-06-28 11:33 孙悟空son_ku_kong 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 1 //用指向指针的指针输出若干字符串 2 #include 3 int main(){ 4 char *name[]={"Basic","Visual Basic","C","Visual C++","Pascal","Delphi"}; 5 char **p; 6 p=name; 7 for(int i=0;i<6;i++){ 8 ... 阅读全文
posted @ 2018-06-28 11:30 孙悟空son_ku_kong 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 1 //输入一个1-7的整数,输出对应的星期名,通过调用指针函数实现 2 #include 3 char name[8][20]={"Illegal day","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"}; 4 char *day_name(int n){ 5 if(n7){ 6... 阅读全文
posted @ 2018-06-28 11:29 孙悟空son_ku_kong 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 int max(int x,int y){ 3 if(x>y){ 4 return x; 5 } 6 return y; 7 } 8 9 int min(int x,int y){ 10 if(x<y){ 11 return x; 12 } 13 return y; 14... 阅读全文
posted @ 2018-06-28 11:28 孙悟空son_ku_kong 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 1 //用字符串指针作为函数参数,试下字符串的复制 2 #include 3 void cpystr(char *pss,char *pds){ 4 while( (*pds=*pss)!='\0' ){ 5 pss++; 6 pds++; 7 } 8 } 9 10 int main(){ 11 char *pss="... 阅读全文
posted @ 2018-06-28 11:27 孙悟空son_ku_kong 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1 //输出字符串中第n个字符后的所有字符 2 #include 3 int main(){ 4 int n=10; 5 char *str="This is a book"; 6 str=str+n; 7 printf("%s\n",str); 8 return 0; 9 } 阅读全文
posted @ 2018-06-28 11:26 孙悟空son_ku_kong 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 1 //利用指针的方式输出二位数组的值 2 #include 3 int main(){ 4 int arr[3][4]={ 5 {0,1,2,3}, 6 {4,5,6,7}, 7 {8,9,10,11} 8 }; 9 int (*p)[4]; 10 p=arr; 11 for(int i=... 阅读全文
posted @ 2018-06-28 11:25 孙悟空son_ku_kong 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 1 //使用指针法,利用数组名计算地址引用数字元素 2 #include 3 int main(){ 4 int a[10]; 5 for(int i=0;i<10;i++){ 6 *(a+i)=i; 7 } 8 for(int j=0;j<10;j++){ 9 printf("%4d",*(a+j)); 10 ... 阅读全文
posted @ 2018-06-28 10:56 孙悟空son_ku_kong 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 1 //编写用指针变量做参数的函数,将输入的两个整数按从大到小顺序输出 2 #include 3 void swap(int *p1,int *p2){ 4 int temp; 5 temp=*p1; 6 *p1=*p2; 7 *p2=temp; 8 } 9 int main(){ 10 int a,b; 11 int *p1,*... 阅读全文
posted @ 2018-06-28 10:55 孙悟空son_ku_kong 阅读(107) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页

导航