![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++研究
肆川
小白一只,妄想通过自学咸鱼翻身
展开
-
初级练手C
1.很杂,关于逗号,小数点位数 #include<stdio.h> int main() { int a; int i,m,n; float x,y; x = 13 / 3; y = 13 / 3.0; char ch; ch = 'A' + '6' - '3'; i = ((a = 2 * 3, a * 5), a + 6); m = 9, 8, 7; n = (9, 8, 7); printf("%d ; %c\n", ch,ch); printf("i=%d原创 2022-05-23 21:57:44 · 440 阅读 · 0 评论 -
关于指针的一些麻烦思考
存在: 1:单向传送,形参改变不能使实参跟随改变 2:改变,直接交换a,b,所以无论是啊,还是*p,输出的都一样,全部改变 3:没有用新定义函数,直接交换,答案中e,f值不变,其指针值改变 #include<stdio.h> int main() { void swap(int* p1, int* p2); void chan(int* p3, int* p4); int a = 5, b = 9; int c = 5, d = 9; int e = 5, f = 9..原创 2022-05-08 12:06:31 · 39 阅读 · 0 评论 -
6-2 在数组中查找指定元素
本题要求实现一个在数组中查找指定元素的简单函数。 函数接口定义: int search( int list[], int n, int x ); 其中list[]是用户传入的数组;n(≥0)是list[]中元素的个数;x是待查找的元素。如果找到 则函数search返回相应元素的最小下标(下标从0开始),否则返回−1。 裁判测试程序样例: #include <stdio.h> #define MAXN 10 int search( int list[], i...原创 2022-05-08 10:37:27 · 500 阅读 · 0 评论