上一页 1 ··· 275 276 277 278 279 280 281 282 283 ··· 367 下一页
摘要: 1、 #include <stdio.h> #define NUMBER 10 int main(void) { int i; char s[NUMBER][128]; for(i = 0; i < NUMBER; i++) { printf("s[%d] = ", i); scanf("%s", 阅读全文
posted @ 2021-05-25 21:10 小鲨鱼2018 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { char s[] = "ABC"; printf("begin: %s\n", s); int i; for(i = 0; i < 4; i++) { s[i] = '\0'; } printf("end: %s\n", 阅读全文
posted @ 2021-05-25 18:26 小鲨鱼2018 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 字符串字面量的中间也可以有null字符,不过应注意区分。字符串字面量“ABC”是字符串,而字符串字面量“AB\0CD”不是字符串。 1、 #include <stdio.h> int main(void) { char str[] = "ABC\0DEF"; printf("result: %s.\ 阅读全文
posted @ 2021-05-25 18:08 小鲨鱼2018 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int gcd(int x, int y) { int max, min, tmp; max = x > y ? x : y; min = x > y ? y : x; tmp = x % y; if(tmp != 0) { gcd(min, tmp); 阅读全文
posted @ 2021-05-25 12:58 小鲨鱼2018 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int fac(int x) { if(x > 0) return x * fac(x - 1); else return 1; } int main(void) { int n, r; puts("please input two integers.") 阅读全文
posted @ 2021-05-25 11:40 小鲨鱼2018 阅读(68) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> enum a {x, y, z}; int main(void) { printf("x = %d\n", x); printf("y = %d\n", y); printf("z = %d\n", z); return 0; } 2、 #include 阅读全文
posted @ 2021-05-25 09:39 小鲨鱼2018 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 1、从尾至头,升序 #include <stdio.h> #define NUMBER 5 void sort_1(int x[], int n) { int i, j; for(i = 0; i < n - 1; i++) { for(j = n - 1; j > i; j--) { if(x[j 阅读全文
posted @ 2021-05-25 08:44 小鲨鱼2018 阅读(2460) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> #define swap(type, x, y) type tmp = x; x = y; y = tmp; int main(void) { int x = 10, y = 5; swap(int, x, y); printf("x = %d\n", x 阅读全文
posted @ 2021-05-24 18:39 小鲨鱼2018 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> #define max(x, y) ((x > y) ? x : y) int main(void) { int a, b, c, d; puts("please input four integers."); printf("a = "); scanf( 阅读全文
posted @ 2021-05-24 18:29 小鲨鱼2018 阅读(63) 评论(0) 推荐(0) 编辑
摘要: c语言 8-1 1、 #include <stdio.h> #define diff(x, y) ((x) - (y)) int main(void) { int a, b; puts("please input two integers."); printf("a = "); scanf("%d" 阅读全文
posted @ 2021-05-24 18:09 小鲨鱼2018 阅读(353) 评论(0) 推荐(0) 编辑
上一页 1 ··· 275 276 277 278 279 280 281 282 283 ··· 367 下一页