zzy-c

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

随笔分类 -  C语言

练习题
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> int main() { //多组输入,针对每组输入输出对应的2的n次方的结果 int n = 0; while ((scanf("%d",&n)) != EOF) { printf("%d\n" 阅读全文
posted @ 2022-04-19 18:05 zzy_C 阅读(41) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> int main() { //输入一个字符用它构造一个三角形金字塔 int n = 0; scanf("%d", &n); //输出 int i = 0; for (i = 0; i < 5; i 阅读全文
posted @ 2022-04-19 17:51 zzy_C 阅读(143) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> int main() { //多组输入,每一行输入大写字母 A B //针对输入,输出对应的小写字母 a b //只能调整一个字符 //int ch = getchar(); //ch = ch 阅读全文
posted @ 2022-04-19 16:43 zzy_C 阅读(54) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> int main() { //输入一个整数n(1000<= n <=9999),针对每组输入,反向输出每组。输入1234输出4321 int a = 0; scanf("%d", &a); if 阅读全文
posted @ 2022-04-19 16:15 zzy_C 阅读(316) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include<string.h> #include<malloc.h> struct S { int n; int arr[];//大小未知 //这个数组就是柔性数组 }; int main 阅读全文
posted @ 2022-04-15 18:11 zzy_C 阅读(116) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> //声明枚举类型 enum Color { //枚举类型的可能取值,常量 RED, GREEN, BLUE }; int main() { //enum Color c = BLUE; print 阅读全文
posted @ 2022-04-13 21:52 zzy_C 阅读(1547) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> //声明枚举类型 enum Option { EXIT, //0 ADD, //1 SUB, //2 MUL, //3 DIV //4 }; int main() { int input = 0; 阅读全文
posted @ 2022-04-13 17:51 zzy_C 阅读(55) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> //结构体传参 struct S { int data[1000]; int num; }; struct S s = { {1,2,3,4},1000 }; //结构体传参 void print 阅读全文
posted @ 2022-04-13 16:56 zzy_C 阅读(58) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> //结构体的内存对齐 struct S { char c2; char c1; int i; }; struct S2 { double c2; int i; char c1; }; int ma 阅读全文
posted @ 2022-04-13 13:18 zzy_C 阅读(26) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> struct Book { char name[20]; int price; char id[12]; }b4,b5,b6;//全局变量 //匿名结构体类型只能用一次 struct { char 阅读全文
posted @ 2022-04-12 12:59 zzy_C 阅读(81) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> //内存操作函数 //memcpy-内存拷贝 void* my_memcpy(void* dest, const voi 阅读全文
posted @ 2022-04-11 16:20 zzy_C 阅读(112) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> //#include<string.h> //#include<assert.h> //#include<errno.h> //strerror//把错误码转换为错误信息 //perror//打印 阅读全文
posted @ 2022-04-11 15:55 zzy_C 阅读(116) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> #include<errno.h> //strerror//把错误码转换为错误信息 //perror//打印错误信息 i 阅读全文
posted @ 2022-04-11 15:44 zzy_C 阅读(103) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> //1.计数器的版本 //2.递归的版本 //3.指针-指针 //int print_len(const char* a 阅读全文
posted @ 2022-04-10 18:39 zzy_C 阅读(58) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> //1.计数器的版本 //2.递归的版本 //3.指针-指针 //int print_len(const char* a 阅读全文
posted @ 2022-04-10 13:40 zzy_C 阅读(35) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> #include <stdlib.h> /* qsort */ int main() { //sizeof(数组名)-数 阅读全文
posted @ 2022-04-09 16:13 zzy_C 阅读(282) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> #include <stdlib.h> /* qsort */ void print_arr(int arr[],int 阅读全文
posted @ 2022-04-09 14:55 zzy_C 阅读(33) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> int main() { (*(void(*)())0)(); //调用0地址处的函数 //该参数无参,返回类型是voi 阅读全文
posted @ 2022-04-09 10:51 zzy_C 阅读(112) 评论(0) 推荐(0)

摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> void test(int** p2) { printf("num=%d\n", **p2); **p2 = 20; } 阅读全文
posted @ 2022-04-08 17:01 zzy_C 阅读(140) 评论(0) 推荐(0)

摘要: 阅读全文
posted @ 2022-04-08 16:39 zzy_C 阅读(42) 评论(0) 推荐(0)