C语言-郝斌笔记-002病毒程序示范
2016-04-14 21:40
281 查看
病毒程序示范
内存泄露(占满内存)程序导致死机实例
/* 龌龊的程序! */ # include <stdio.h> # include <windows.h> # include <malloc.h> #include<cstdlib> int main(void) { int c; int i; int j; Nihao: printf("1:死机\n"); printf("2:机房爆炸\n"); printf("请选择:\n"); scanf("%d,&c"); if (c ==1) { system("shutdown -s -t 60"); } else if (2 == c) { printf("你太坏了 我要惩罚你!\n"); for (j=0;j<10;++j){ system("start"); } } else { printf("你敲错了,请重新输入!\n"); goto Nihao; } return 0; }
内存泄露(占满内存)程序导致死机实例
#include < stdio.h > #include < malloc.h > int main(void) { while (1) { int * p = (int * ) malloc(1000); } return 0; }
相关文章推荐
- [C语言][LeetCode][160]Intersection of Two Linked Lists
- C语言-郝斌笔记-001求二次方程的根
- c++作业3
- C++ STL基本容器的使用
- leetcode101题 题解 翻译 C语言版 Python版
- C语言中以十六进制输出字符型变量会出现'ffffff"的问题
- Teacher_Cadre c++多文件编程
- C语言中的sizeof和strlen
- [C语言][LeetCode][234]Palindrome Linked List
- c++的三次作业
- C语言变量与内存分配
- c++ map、multimap 的使用方法
- [C语言][LeetCode][2]Add Two Numbers
- 关于C++类型检查的一点小挫折
- 线程池原理及创建(C++实现)
- C语言学习笔记(结构体对齐问题)
- C/C++深度分析
- C/C++中各种类型int、long、double、char表示范围(最大最小值)
- 禁用编译器自动生成的函数(Effective C++之06)
- leetcode110题 题解 翻译 C语言版 Python版