12 2023 档案

摘要:#include <stdio.h> int main() { int i = 1; int a = (++i) + (++i); printf("a = %d,i = %d\n", a, i);//a = 6,i = 3 i = 1; a = (++i) + (i = 100); printf(" 阅读全文
posted @ 2023-12-27 11:02 Kazuma_124 阅读(10) 评论(0) 推荐(0) 编辑
摘要:向函数传入某数组时,可以在函数内修改该数组的元素。 #include <stdio.h> void test(char* p, char arr[]) { *p = 'h';//能改变 *arr = 'h';//能改变 *(p + 1) = 'e';//能改变 *(arr + 1) = 'e';// 阅读全文
posted @ 2023-12-25 16:22 Kazuma_124 阅读(22) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <string.h> #define MAX 500 void test() { char arr1[] = { '1','2','3','4','\0','5','6','7','8' }; char arr2[] = { 'a','a',' 阅读全文
posted @ 2023-12-25 15:14 Kazuma_124 阅读(17) 评论(0) 推荐(0) 编辑
摘要:strcpy 要求传入的两个指针 restrict(即区间不重叠)。 因此直接 strcpy(&a[1],a) 是未定义行为。 阅读全文
posted @ 2023-12-24 20:51 Kazuma_124 阅读(6) 评论(0) 推荐(0) 编辑
摘要:void test() { FILE* fp = fopen("test.txt", "w"); if (fp == NULL) { perror("fopen error"); exit(1); } char a[5] = { '1','2','\0','3','4' }; fwrite(a, s 阅读全文
posted @ 2023-12-24 20:07 Kazuma_124 阅读(30) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> int main() { //printf()函数不同参数间可以换行 printf("num one : %d,num two : %d", 1, 2); //printf字符串内换行的三种方法 //一 printf("Here's one way to pri 阅读全文
posted @ 2023-12-24 14:05 Kazuma_124 阅读(620) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> int main() { int i = 3; for (i; i; i--) { printf("%d\n", i); } //3\n2\n1\n for (int i = 0; 1; i++) { if (!(i - 10)) { break; } prin 阅读全文
posted @ 2023-12-23 13:18 Kazuma_124 阅读(11) 评论(0) 推荐(0) 编辑
摘要:学生成绩管理系统 页面效果如图: 代码如下: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> //行和列常量 #define ROW 20 #define COL 83 typedef stru 阅读全文
posted @ 2023-12-21 20:32 Kazuma_124 阅读(49) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #define AAA 111 void test() { printf("__LINE__ = % d\n", __LINE__); printf("AAA = %d\n", AAA); } #define AAA 222 #line 1 "test" int 阅读全文
posted @ 2023-12-21 19:45 Kazuma_124 阅读(13) 评论(0) 推荐(0) 编辑
摘要:char a[] = "hello%d\n%dworld"; printf(a, 2, 3); //输出: //hello2 //2world 事情的起因是使用printf("\033[0;47;30m");改变命令行字体背景和颜色的时候,室友提起能否让用户改变字体颜色。因为那需要改变printf( 阅读全文
posted @ 2023-12-11 17:15 Kazuma_124 阅读(22) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示