- 博客(8)
- 收藏
- 关注
原创 定义数组的思考与实验
#include <stdlib.h>#include <stdio.h>#include <unistd.h>static void show_pointer(void *p, char *descr) { // printf("Pointer for %s at %p\n", descr, p); printf("%s\t%p\...
2019-05-28 10:20:55 211
原创 缓冲区溢出演示
运行如下代码:/* Demonstration of buffer overflow */#include <stdio.h>#include <stdlib.h>/* Implementation of library function gets() */char *gets(char *dest){ int c = getchar(); char ...
2019-05-27 20:41:02 332
原创 十六进制数字转换为以‘\n’结尾的字符串
/* Convert sequence of hex digits on command line into a string, terminated by \n *//*将一串命令行的十六进制数字转换为以‘\n’结尾的字符串*/#include <stdio.h>#include <stdlib.h>int main(int argc, char *argv[])...
2019-05-27 19:57:49 2035
原创 浮点数加减运算的思考
运行如下代码:#include <stdio.h>#include <stdlib.h>#include <string.h>#define BUFSIZE 256int main(int argc, char *argv[]) { char prefix[BUFSIZE]; char next[BUFSIZE]; int i; ...
2019-05-27 19:31:00 324
原创 递归的思考与实验
/* Example of deep recursion */#include <stdio.h>#include <stdlib.h>int recurse(int x) { int a[1<<15]; /* 4 * 2^15 = 64 KiB */ printf("x = %d. a at %p\n", x, a); ...
2019-05-27 19:16:09 167
原创 深入了解计算机系统中:unsigned char、char和int的思考和实验
/* show-bytes - prints byte representation of data *//* $begin show-bytes */#include <stdio.h>/* $end show-bytes */#include <stdlib.h>#include <string.h>/* $begin show-bytes */...
2019-05-27 17:49:53 411
原创 关于栈溢出的思考与实验
运行如下代码:#include <stdio.h>#include <stdlib.h>typedef struct { int a[2]; double d;} struct_t;double fun(int i) { volatile struct_t s; s.d = 3.14; s.a[i] = 10737418...
2019-05-27 17:35:39 336
原创 数据类型的溢出
先运行如下代码,看看结果:#include <stdio.h>#include <stdlib.h>int sq(int x) { return x*x;}int main(int argc, char *argv[]) { int i; for (i = 1; i < argc; i++) { int x = atoi(arg...
2019-05-27 17:15:22 843
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人