![](https://img-blog.csdnimg.cn/d605ef5cc4a047d5ada0b6df6c463f56.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
C语言
大学生学习C语言笔记叭叭叭
表哥抱表弟
这个作者很懒,什么都没留下…
展开
-
C语言实现扫雷游戏
话不多说直接淦代码,代码都有详细注释: #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <time.h> #include <stdlib.h> #include <Windows.h> #define ROW 9 #define LIN 9 #define ROWS 11 #define LINS 11 #define MINE_COUNT 10 //1.菜单 void menu()原创 2021-11-08 21:10:32 · 2710 阅读 · 0 评论 -
(C)宏定义整数的二进制位的奇数位和偶数位交换
1.首先要单独取出奇数位和偶数位的数字 这里我们使用两个16 进制的一对数字:0x55555555和0xaaaaaaaa 2.把我们要求得整数转换成二进制按位与0x55555555与得出奇数位的数字向左移一位就到了偶数位(这里我们假设为),同理得出偶数位的数字右移一位: 由此:由0111->1011;1011转换成10进制为11 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include <asse...原创 2021-11-06 16:24:33 · 254 阅读 · 0 评论 -
C-----实现atoi函数
多的不说直接淦代码: #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h> int My_atoi(const char* str) { assert(str);//判断指针 int flag = 1;//符号位默认为正数 int ret = 0;//返回值初始化 char* p =原创 2021-11-06 15:22:56 · 115 阅读 · 2 评论 -
C语言创建链表并输出
代码如下: #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include <assert.h> #include <string.h> #include <stdlib.h> typedef struct linklist { int data; struct linklist* next; }node; int main(void) { node* head = (node*)malloc(s原创 2021-11-04 21:43:32 · 2030 阅读 · 0 评论 -
C语言----关于函数strcat的简单实现
1.首先介绍一下函数strcat char * strcat ( char * destination, const char * source ) char* destination是需要拼接的目标字符串的指针; const char * source是拼接的字符串; 返回值类型为char*,返回一个指向最终目标字符串的指针; #include<stdio.h> #include <assert.h> char* My_strcat( char* str, const原创 2021-11-03 18:31:37 · 303 阅读 · 4 评论 -
C课设---通讯录程序
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string> #include <windows.h> typedef struct PersonInfo { //描述一个联系人 char name[1024]; char phone[1024]; }PersonInfo; typede.原创 2021-10-31 17:12:24 · 101 阅读 · 5 评论 -
C语言实现三子棋(小白专属)
程序和流程都很详细的在备注里面啦~~ #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <time.h> #define row 3 #define col 3 int isFull(char borad[row][col]) { //找不到' '为没满满返回1 //没有满返回0 for (int i = 0; i < row; i++) {原创 2021-10-25 20:44:44 · 82 阅读 · 2 评论 -
(C)关于sizeof()和strlen和指针的习题
关于sizeof的坑 <1>数字数组 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main() { int a[] = { 1,2,3,4 }; printf("%d\n", sizeof(a)); // 16;a在这里指的是数组a,所以数组a有四个元素=>4*4=16 printf("%d\n", sizeof(a + 0)); //4;a+0在这里被隐式转换为指针,即为a[0]这个..原创 2021-10-24 18:46:33 · 1174 阅读 · 2 评论