摘要: int a[10]; int *pa; pa=&a[0];//让指针指向数组第一个元素 x=*pa;//复制 *(pa+1)//指向数组的下一个元素 字符串拷贝算法1: void strcpy(char *s,char*t) { int i; i=0; while((s[i]=t[i])!='0') i++; } 算法2: void strcpy(char *s,char *t) { while... 阅读全文
posted @ 2009-06-24 05:30 macula7 阅读(122) 评论(0) 推荐(0)
摘要: int a[10]; int *pa; pa=&a[0];//让指针指向数组第一个元素 x=*pa;//复制 *(pa+1)//指向数组的下一个元素 字符串拷贝算法1: void strcpy(char *s,char*t) { int i; i=0; while((s[i]=t[i])!='0') i++; } 算法2: void strcpy(char *s,char *t) { while... 阅读全文
posted @ 2009-06-24 05:30 macula7 阅读(96) 评论(0) 推荐(0)
摘要: #include void swap(int *x,int *y)//该函数能交换两个参数的值,调用的时候使用地址,交换地址 { int temp; temp=*x; *x=*y; *y=temp; } main() { int x=1,y=2,z[10]; int *ip; ip=&x; //ip指向x y=*ip; //y的值现在为1 *ip=0; //x的... 阅读全文
posted @ 2009-06-24 05:03 macula7 阅读(101) 评论(0) 推荐(0)
摘要: #include void swap(int *x,int *y)//该函数能交换两个参数的值,调用的时候使用地址,交换地址 { int temp; temp=*x; *x=*y; *y=temp; } main() { int x=1,y=2,z[10]; int *ip; ip=&x; //ip指向x y=*ip; //y的值现在为1 *ip=0; //x的... 阅读全文
posted @ 2009-06-24 05:03 macula7 阅读(153) 评论(0) 推荐(0)
摘要: #include int atoi(char s[])//转换的方法 { int i,n; n=0; for(i=0;s[i]>='0'&&s[i]<='9';++i) n=10*n+(s[i]-'0'); return n; } main() { int n=0,m=0; char s [10],s1[10]; ... 阅读全文
posted @ 2009-06-24 01:08 macula7 阅读(145) 评论(0) 推荐(0)
摘要: #include int atoi(char s[])//转换的方法 { int i,n; n=0; for(i=0;s[i]>='0'&&s[i]<='9';++i) n=10*n+(s[i]-'0'); return n; } main() { int n=0,m=0; char s [10],s1[10]; ... 阅读全文
posted @ 2009-06-24 01:08 macula7 阅读(981) 评论(0) 推荐(0)
摘要: int反映特定机器的自然大小,一般为16位或者32位 short一般为16位,long一般为32位 各个编译器可能不同,没有硬性规定,唯一的限制是short类型与int类型至少要有16位,而long类型至少32位。short对象不得长于int对象,int对象不得长于ling对象 singed用于限定数据是否有符号位。 \a 响铃符 \b 回退 \f 换页 \n 换行 \r 回车 \t 横向制表符 ... 阅读全文
posted @ 2009-06-24 00:54 macula7 阅读(92) 评论(0) 推荐(0)
摘要: int反映特定机器的自然大小,一般为16位或者32位 short一般为16位,long一般为32位 各个编译器可能不同,没有硬性规定,唯一的限制是short类型与int类型至少要有16位,而long类型至少32位。short对象不得长于int对象,int对象不得长于ling对象 singed用于限定数据是否有符号位。 \a 响铃符 \b 回退 \f 换页 \n 换行 \r 回车 \t 横向制表符 ... 阅读全文
posted @ 2009-06-24 00:54 macula7 阅读(110) 评论(0) 推荐(0)
摘要: #include main() { int c,i,nwhilte,nother; int ndigit[10]; nwhilte=nother=0; for(i=0;i='0'&&c<='9') ++ndigit[c-'0']; else if(c==' '||c=='\n'||c=='\t') ++n... 阅读全文
posted @ 2009-06-24 00:38 macula7 阅读(178) 评论(0) 推荐(0)
摘要: #include main() { int c,i,nwhilte,nother; int ndigit[10]; nwhilte=nother=0; for(i=0;i='0'&&c<='9') ++ndigit[c-'0']; else if(c==' '||c=='\n'||c=='\t') ++n... 阅读全文
posted @ 2009-06-24 00:38 macula7 阅读(222) 评论(0) 推荐(0)
摘要: 1:字符计数 #include main() { char c; double n=0; //注意可以使用double 类型 while((c=getchar())!=EOF) n++; printf("%.0f",n); } 2:行计数 #include main() { char c; int n=0; ... 阅读全文
posted @ 2009-06-24 00:27 macula7 阅读(147) 评论(0) 推荐(0)
摘要: 1:字符计数 #include main() { char c; double n=0; //注意可以使用double 类型 while((c=getchar())!=EOF) n++; printf("%.0f",n); } 2:行计数 #include main() { char c; int n=0; ... 阅读全文
posted @ 2009-06-24 00:27 macula7 阅读(173) 评论(0) 推荐(0)
摘要: #define 名字 替换文本 例子: #define LOWER 0 #define UPPER 300 #define STEP 20 阅读全文
posted @ 2009-06-24 00:06 macula7 阅读(123) 评论(0) 推荐(0)
摘要: #define 名字 替换文本 例子: #define LOWER 0 #define UPPER 300 #define STEP 20 阅读全文
posted @ 2009-06-24 00:06 macula7 阅读(149) 评论(0) 推荐(0)
摘要: #include main() { float fahr,celsius,upper; int lower ,step; lower =0 ; upper=300; step =20; fahr=lower; while(fahr<=upper) { celsius=(5.0/9.0)*(... 阅读全文
posted @ 2009-06-24 00:03 macula7 阅读(97) 评论(0) 推荐(0)
摘要: #include main() { float fahr,celsius,upper; int lower ,step; lower =0 ; upper=300; step =20; fahr=lower; while(fahr<=upper) { celsius=(5.0/9.0)*(... 阅读全文
posted @ 2009-06-24 00:03 macula7 阅读(139) 评论(0) 推荐(0)