![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C基础
文章平均质量分 78
零度咖啡
这个作者很懒,什么都没留下…
展开
-
strlen函数C实现
1、函数功能介绍 strlen 函数用来求字符串的长度(包含多少个字符,不包含'\0')。 2、函数实现C代码 #include <stdio.h> int strlen1(char s[]) { int i = 0; while(*s++) i++; return i; } in...原创 2020-02-16 12:42:24 · 209 阅读 · 0 评论 -
atoi函数和itoa函数C代码实现
一、atoi函数实现 1、atoi (表示 ascii to integer)是把字符串转换成整型数的一个函数。 2、C代码实现如下 #include <stdio.h> #include <ctype.h> /*atoi() function:convert string to integer*/ int atoi(char str[]...原创 2020-02-16 10:58:25 · 298 阅读 · 0 评论 -
统计程序输入中各个数字、空白符和其他字符出现的次数
1、if-else语句C实现 #include <stdio.h> /* count digits, white space, others */ main() { int c, nwhite, nother; int ndigit[10]; nwhite = nother = 0; for(int i = 0; i < 10; +...原创 2020-02-16 11:01:18 · 525 阅读 · 0 评论 -
Volatile相关的一些底层知识
CPU是你机器的心脏,最终由它来执行所有运算和程序。主内存(RAM)是你的数据(包括代码行)存放的地方。CPU和主内存之间有好几层缓存,因为即使直接访问主内存也是非常慢的。如果你正在多次对一块数据做相同的运算,那么在执行运算的时候把它加载到离CPU很近的地方就有意义了(比如一个循环计数-你不想每次循环都跑到主内存去取这个数据来增长它吧)。 越靠近CPU的缓存越快也越小。所以L1缓原创 2013-05-09 11:41:25 · 492 阅读 · 0 评论 -
把由十六进制数字组成的字符串转换为与之等价的整数值
#include "stdafx.h"#include /*htoi: converts hexadecimal string to integer */int htoi(char s[]){int hexdigit,i,n;i = 0;if(s[i] == '0') /*skip optional 0x or 0X*/{i++;if(s[i] == 'x' || s[i] == 'X')i++;原创 2013-11-24 22:46:46 · 1074 阅读 · 0 评论 -
队列的链表实现
//队列的链表实现 #include "stdafx.h" #include #define TRUE 1 #define FALSE 0 #define OK 1 #define ERR 0 typedef int QElemType; typedef int Status; typedef struct QNode_tag { QElemType原创 2015-03-08 23:08:06 · 289 阅读 · 0 评论 -
栈的数组和链表实现
一、顺序栈的数组实现 #include "stdafx.h" #include #define MAX_SIZE_STACK 1024 /*栈的大小*/ #define IS_EMPTY_STACK 1; #define IS_NOT_EMPTY_STACK 0; typedef struct { int data[MAX_SIZE_STACK];原创 2015-03-08 09:15:22 · 311 阅读 · 0 评论 -
单链表的实现
//单链表的实现 #include "stdafx.h" #include typedef int status; typedef int elemtype; typedef struct LNode { elemtype num; struct LNode *next; }LNode,*LinkList; void CreatList_L(LinkList *原创 2015-03-09 21:51:53 · 488 阅读 · 0 评论