上一页 1 ··· 272 273 274 275 276 277 278 279 280 ··· 367 下一页
摘要: c语言中利用函数同时返回两个数的和与差。 1、 #include <stdio.h> void sum_diff(int n1, int n2, int sum, int diff) { sum = n1 + n2; diff = (n1 > n2) ? (n1 - n2) : (n2 - n1); 阅读全文
posted @ 2021-05-29 09:12 小鲨鱼2018 阅读(960) 评论(0) 推荐(0) 编辑
摘要: 1、单目运算符&为取址运算符,其作用是获取对象的地址,生成指向对象的指针,与其说是获取地址,不如说是生成指针。对象地址的转换说明为%p,其中的p为pointer的首字母。 #include <stdio.h> int main(void) { int n; double x; int a[3]; p 阅读全文
posted @ 2021-05-29 08:58 小鲨鱼2018 阅读(1293) 评论(0) 推荐(0) 编辑
摘要: c语言中指针作为参数的函数同时计算两个数的和与差。 1、 #include <stdio.h> void sum_dif(int n1, int n2, int *sum, int *dif) { *sum = n1 + n2; *dif = (n1 > n2) ? (n1 - n2) : (n2 阅读全文
posted @ 2021-05-28 23:13 小鲨鱼2018 阅读(1234) 评论(0) 推荐(0) 编辑
摘要: c语言中将指针作为函数的参数。 1、 #include <stdio.h> void fun(int *x) { if(*x < 170) // 指向特定对象的指针,在使用指针运算符的时候就是该对象的别名,对别名进行重新赋值,可以传递给main函数。 { *x = 1000; } } int mai 阅读全文
posted @ 2021-05-28 22:24 小鲨鱼2018 阅读(347) 评论(0) 推荐(0) 编辑
摘要: c语言中指针 1、 #include <stdio.h> int main(void) { int a = 100; int b = 200; int c = 300; int *x, *y; x = &a; y = &c; printf("xxxx: %d\n", *x); printf("yyy 阅读全文
posted @ 2021-05-28 16:52 小鲨鱼2018 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> void rev(char x[][128], int n) { int i; for(i = 0; i < n; i++) { int len = 0; while(x[i][len]) len++; int j = 0; while(x[i][j]) 阅读全文
posted @ 2021-05-27 19:12 小鲨鱼2018 阅读(55) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> #define NUMBER 5 #define STR 128 void show(char x[][STR], int n) { int i; for(i = 0; i < n; i++) { if(strcmp(x[i], "$$$$$") == 0 阅读全文
posted @ 2021-05-27 18:45 小鲨鱼2018 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> void del(char x[]) { int len = 0; while(x[len]) len++; char tmp[len]; int i = 0, j = 0; while(x[i]) { if(x[i] < '0' || x[i] > '9 阅读全文
posted @ 2021-05-27 17:28 小鲨鱼2018 阅读(65) 评论(0) 推荐(0) 编辑
摘要: c语言中大小写字符转换。 1、 #include <stdio.h> #include <ctype.h> void upper(char x[]) { int i = 0; while(x[i]) { x[i] = toupper(x[i]); i++; } } void lower(char x 阅读全文
posted @ 2021-05-27 17:02 小鲨鱼2018 阅读(1836) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> void put(char x[]) { int len = 0; while(x[len]) len++; int i; for(i = 0; i < len / 2; i++) { int tmp = x[i]; x[i] = x[len - 1 - 阅读全文
posted @ 2021-05-27 16:52 小鲨鱼2018 阅读(48) 评论(0) 推荐(0) 编辑
上一页 1 ··· 272 273 274 275 276 277 278 279 280 ··· 367 下一页