C/C++
sourire_will
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
atoi函数实现
#include <stdio.h> #if 0 #include <stdlib.h> #else int atoi(const char *a) { int negative = 0; int sign = 0; int val = 0; while (*a != '\0') { if (*a == '+' || *a == '-') { if ...原创 2018-06-18 18:31:47 · 215 阅读 · 0 评论 -
strcmp函数实现
#include <stdio.h> #if 0 #include <string.h> #else int strcmp(const char *a, const char *b) { int i = 0; while (a[i] != '\0' && a[i] == b[i]) ++i; return a[i] - b[i]; } #endif...原创 2018-06-18 18:37:09 · 603 阅读 · 0 评论 -
strcpy函数实现
#include <stdio.h> char *strcpy(char *dst, const char *src) { char *res = dst; while ((*dst++ = *src++) != '\0') ; return res; } int main(void) { char src[] = "hello"; char dst[32] = {'...原创 2018-06-18 18:38:34 · 213 阅读 · 0 评论
分享