摘要:
c语言中作为函数参数的指针。 1、 #include <stdio.h> void fun(int *x) //声明指向int型的指针变量 { if(*x < 200) { *x = 5000; } } int main(void) { int a = 100; int b = 140; int c 阅读全文
posted @ 2021-05-29 09:23
小鲨鱼2018
阅读(439)
评论(0)
推荐(0)
摘要:
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
阅读(1051)
评论(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
阅读(1484)
评论(0)
推荐(0)