摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> int main() { //多组输入,针对每组输入输出对应的2的n次方的结果 int n = 0; while ((scanf("%d",&n)) != EOF) { printf("%d\n"
阅读全文
随笔分类 - 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"
阅读全文
摘要:#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
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> int main() { //多组输入,每一行输入大写字母 A B //针对输入,输出对应的小写字母 a b //只能调整一个字符 //int ch = getchar(); //ch = ch
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> int main() { //输入一个整数n(1000<= n <=9999),针对每组输入,反向输出每组。输入1234输出4321 int a = 0; scanf("%d", &a); if
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include<string.h> #include<malloc.h> struct S { int n; int arr[];//大小未知 //这个数组就是柔性数组 }; int main
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> //声明枚举类型 enum Color { //枚举类型的可能取值,常量 RED, GREEN, BLUE }; int main() { //enum Color c = BLUE; print
阅读全文
摘要:#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;
阅读全文
摘要:#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
阅读全文
摘要:#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
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> struct Book { char name[20]; int price; char id[12]; }b4,b5,b6;//全局变量 //匿名结构体类型只能用一次 struct { char
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> //内存操作函数 //memcpy-内存拷贝 void* my_memcpy(void* dest, const voi
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> //#include<string.h> //#include<assert.h> //#include<errno.h> //strerror//把错误码转换为错误信息 //perror//打印
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> #include<errno.h> //strerror//把错误码转换为错误信息 //perror//打印错误信息 i
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> //1.计数器的版本 //2.递归的版本 //3.指针-指针 //int print_len(const char* a
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> //1.计数器的版本 //2.递归的版本 //3.指针-指针 //int print_len(const char* a
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> #include <stdlib.h> /* qsort */ int main() { //sizeof(数组名)-数
阅读全文
摘要:#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
阅读全文
摘要:#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include<string.h> #include<assert.h> int main() { (*(void(*)())0)(); //调用0地址处的函数 //该参数无参,返回类型是voi
阅读全文
摘要:#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; }
阅读全文
|