
C语言
文章平均质量分 82
klwz2011
祝你天天快乐
展开
-
Python与C语言对比大全(持续更新中)
Python每句代码没有; 而C语言有Python代码是以缩进来嵌套 而C语言是{}区分Python格式化输出:print(f"test")C:printf(“test”);其他格式化输出对比请读者自行查阅。Python只有float一种浮点类型 C不仅有float还有double以及...原创 2021-12-22 19:25:24 · 4171 阅读 · 4 评论 -
strcat函数C语言实现
#include <stdio.h>void *mystrcat(char* str1, const char* str2){ int length1 = 0; while (*(str1 + length1) != '\0') { length1++; } int length2 = 0; while (*(str2 + length2) != '\0') { *(str1 + length1 + length2) = *(str2 + length2); l原创 2020-12-31 16:17:31 · 360 阅读 · 0 评论 -
strlen函数C语言实现
#include <stdio.h>int Strlen(char *s){ int sum = 0; while (*s++ != '\0') sum++; return sum;}int main(){ char a[50]; printf("请输入一个字符串:\n"); scanf("%s", &a); printf("输入的字符串长度为%d", Strlen(a)); system("pause"); return 0;}...原创 2020-12-31 15:47:26 · 125 阅读 · 0 评论 -
Visual Studio使用scanf函数提示使用scanf_s
1.问题描述使用scanf()函数,提示修改为scanf_s()函数2.解决方案方案(1)修改sacnf()为scanf_s()。方案(2)代码顶部添加#pragma warning(disable : 4996)方案(3)代码顶部添加#define _CRT_SECURE_NO_WARNINGS原创 2020-11-28 14:13:58 · 735 阅读 · 0 评论 -
如何用三行代码卡死一个系统?
Rogue.cint main(){while(1){fork();}}fork函数简介fork系统调用用于创建一个新进程,称为子进程,它与进行fork()调用的进程(父进程)并发运行。创建新的子进程后,两个进程都将执行fork()系统调用之后的下一条指令。子进程使用相同的PC(程序计数器),相同的CPU寄存器,相同的打开文件,这些文件在父进程中使用。...原创 2020-11-26 13:41:35 · 593 阅读 · 0 评论