📄 hello.c
字号:
#include <stdio.h>#include <stdlib.h>#include <string.h>char *hello1,*hello2;voidmemory_use(){ hello1 = (char *)malloc(32); strcpy(hello1, "hello world"); hello2 = (char *)malloc(strlen(hello1)+1); strcpy(hello2,hello1);}voidmemory_leak(){ char *local; local = (char *)malloc(32); strcpy(local,"hello world");}void access_error(){ int i,j; i=j;}intmain(){ memory_use(); access_error(); memory_leak(); printf("%s\n",hello2); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -