• 博客园logo
  • 会员
  • 周边
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
zhm521
博客园 首页 新随笔 联系 订阅 订阅 管理
上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页

2020年11月20日

自定义类型:结构体、枚举、联合
摘要: 结构体 在之前的博客中有谈到过结构体的一些简单用法,现在我们先回顾一下结构体的简单知识点,再接着来聊聊结构体的更深层次的用法。 结构体声明 #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct test { 阅读全文
posted @ 2020-11-20 14:37 zhm521 阅读(246) 评论(0) 推荐(0)
 
字符串/内存相关的库函数
摘要: 字符串即内存操作函数 本篇博客将介绍一些字符串及内存标准库函数,这些函数都是标准库中提前准备好了的,而我们需要做的是: ①能够熟练使用 ②能够深度使用(了解内部的一些坑,并能规避) ③能够扩展(了解内部实现) 当我们能够做到这些的时候,我们就可以在编写代码的时候如鱼得水,如虎添翼。需要注意的是,在我 阅读全文
posted @ 2020-11-20 10:08 zhm521 阅读(195) 评论(2) 推荐(0)
 
memcpy库函数模拟实现
摘要: //第一次尝试:#include<stdio.h> #include<stdlib.h> void* myMemcpy(void* destin, void* source, int num) { if (destin == NULL || source == NULL) { return NULL 阅读全文
posted @ 2020-11-20 09:16 zhm521 阅读(139) 评论(0) 推荐(0)
 
memmove库函数模拟实现
摘要: //第一次尝试:#include<stdio.h> #include<stdlib.h> void* myMemmove(void* destin, const void* source,size_t num) { if (destin == NULL || source == NULL) { re 阅读全文
posted @ 2020-11-20 09:02 zhm521 阅读(118) 评论(0) 推荐(0)
 
 

2020年11月18日

strlen库函数模拟实现
摘要: //第一次尝试:#include<stdio.h> #include<stdlib.h> size_t myStrlen(const char* str) { if (str == NULL) { return NULL; } size_t ret = 0; while (*str != '\0') 阅读全文
posted @ 2020-11-18 09:50 zhm521 阅读(119) 评论(0) 推荐(0)
 
strcpy库函数模拟实现
摘要: //第一次尝试:#include<stdio.h> #include<stdlib.h> char* myStrcpy(char* str1, const char* str2) { if (str1 == NULL || str2 == NULL) { return NULL; } char* s 阅读全文
posted @ 2020-11-18 09:19 zhm521 阅读(97) 评论(0) 推荐(0)
 
strcmp库函数模拟实现
摘要: //第一次尝试:#include<stdio.h> #include<stdlib.h> int myStrcmp(const char* str1,const char* str2) { if (str1 == NULL || str2 == NULL) { return NULL; } whil 阅读全文
posted @ 2020-11-18 08:57 zhm521 阅读(173) 评论(0) 推荐(0)
 
 

2020年11月17日

指针进阶
摘要: 字符指针 字符指针即可以指向单个字符,也可以指向一个字符串,一般情况下,我们更常将字符指针应用于指向一个字符串;我们要注意区分字符指针与字符数组的区别,这两个经常在使用的时候被混淆; 代码 char* pstr = "hello world"; 特别容易让我们以为是把字符串“hello world” 阅读全文
posted @ 2020-11-17 20:35 zhm521 阅读(147) 评论(0) 推荐(0)
 
strcat库函数模拟实现
摘要: //第一次尝试:#include<stdio.h> #include<stdlib.h> char* myStrcat(char* str1,const char* str2) { //参数合法性检验 if (str1 == NULL || str2 == NULL) { return NULL; 阅读全文
posted @ 2020-11-17 13:56 zhm521 阅读(149) 评论(0) 推荐(0)
 
strstr库函数模拟实现
摘要: //第一次尝试:#include<stdio.h> #include<stdlib.h> #include<string.h> #define MAX 1024 const char* myStrstr(const char* str1,const char* str2) { // 由于无法保证调用 阅读全文
posted @ 2020-11-17 12:59 zhm521 阅读(92) 评论(0) 推荐(0)
 
 
上一页 1 2 3 4 5 6 7 8 9 ··· 13 下一页

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3