摘要:
9.1 把一个学生的信息(包括学号、姓名、性别、住址)放在一个结构体变量中,然后输出这个学生的信息。 复制代码 #include int main() { struct student { long int num; char name[20]; char sex; char addr[20]; }a = {... 阅读全文
摘要:
#include int main() { void fun(int a[10]); int a[10]={1,2,3,4,5,6,7,8,9,10}; } void fun(int a[]) { int i; int *p; p=&a[i]; for(i=0;i<=9;i++) prin... 阅读全文
摘要:
#include main() {char funstr(char* str); char str [11]="helloworld"; printf("%s\n",str); str[0]='H'; str[6]='w'; puts(str); getchar(); funstr(str);} char funstr(char* str) {int i=0; printf("%s\n... 阅读全文
摘要:
1. void swap(int *p,int *q) {int *temp; *temp=*p; *p=*q; *q=*temp; }不能实现交换的原因:*p就是整型变量,而*temp是指针变量temp所指向的变量,但temp无确定值,因此temp所指向的单元室不可预见的。所以对*temp赋值有可 阅读全文
摘要:
#include int main() { void swap(int *p,int *q); int a,b,*p1,*p2; scanf( "%d%d",&a,&b); p1=&a;p2=&b; if(a<b) swap(p1,p2); printf("\n%d,%d\n",a,b); printf("\n"); } void s... 阅读全文