
C相关
Locokkk
这个作者很懒,什么都没留下…
展开
-
字符串函数的模拟实现(strlen、strcpy、strcat、strstr、strcmp)
一.strlen的模拟实现 strlen是计算字符串长度的函数,它所做的是类似于计数器的工作,从内存的某个位置(字符串开头、字符串中间或者内存中不确定的某个区域)开始计算,直到遇见字符串结束符’\0’为止,最终返回计数器值(不包含’\0’)。 二.strcpy的模拟实现 三.strcat的模拟实现 四.strstr的模拟实现 五.strcmp的模拟实现 ...原创 2019-07-06 12:21:06 · 399 阅读 · 2 评论 -
交换两个变量值(创建临时变量、不创建临时变量)
不创建临时变量:``` #include<stdio.h> #include<stdlib.h> int main() { int a = 0; int b = 0; scanf_s("%d %d", &a, &b); a = a + b; b = a - b; a = a - b; printf("%d %d\n", a, b); system(“paus...原创 2019-03-24 14:30:21 · 361 阅读 · 0 评论 -
判断1000年2000年之间的闰年
#include<stdio.h> #include<stdlib.h> int main() { int year = 0; for (year = 1000; year <= 2000; year++) { if ((year % 4...原创 2019-03-24 14:27:06 · 260 阅读 · 1 评论 -
输出乘法口诀表
#include<stdio.h> #include<stdlib.h> int main() { int a,b; for(a =1;a<= 9;a++) { for(b=1;b<=a;b++) { printf("%d*%d=%2d ", ...原创 2019-03-24 14:25:41 · 155 阅读 · 0 评论