一、转义字符

 #include<stdio.h>

 void main(){
printf("hello \nworld\a");// \n换行 \a机器响一声
getchar();//等待
}
 #include<stdio.h>

 void main(){
//printf("hello world");
putchar('h');
putchar('e');
putchar('l');
putchar('l');
putchar('o');
putchar('\n');//转义字符也是一个字符
putchar('w');
getchar();
}
 #include<stdio.h>

 void main1(){
while() putchar('\a');
putchar('A');//输出一个字符
putchar('\n');//换行
getchar();
}
void main(){
//printf("\\");//只有一个“\”会报错
//putchar('\\');
//printf("\"");
putchar('\'');
getchar();
}

二、hello world的N种做法

 #include<stdio.h>

 void hello1(){
printf("hello world");
}
void hello2(){
printf("A%sB","hello world");//hello world取代%s
}
void hello3(){
printf("%c%c%",'h','e');
}
void hello4(){
putchar('h');
putchar('e');
}
void hello5(){
putchar();//ASCLL码
putchar();
}
void notepad(){//练习:用ascll码打印notepad
putchar();
putchar();
putchar();
putchar();
putchar();
putchar();
putchar();
}
void hello6(){//按照8进制输出helloworld
putchar();//前面带0表示8进制
putchar();
putchar();
putchar();
}
void hello7(){//按照16进制输出helloworld
putchar(0x68);//前面带0x表示16进制
putchar(0x65);
putchar(0x6c);
putchar(0x6c);
}
void hello8(){//按照8进制输出helloworld
putchar('\150');//8进制的150所标志的字符
putchar('\145');// '\ddd',3位八进制代表的字符
putchar('\154');
putchar('\154');
}
void hello9(){//按照16进制输出helloworld
putchar('\x68');// '\xhh',16进制数据转换成编号,查找字符
putchar('\x65');
putchar('\x6c');
putchar('\x6c');
}
void hello10(){
puts("hello world");
} void main(){
hello10();
getchar();
}

三、打开程序的n种做法

 #include<stdio.h>
#include<stdlib.h> void main(){
//char str[50]="notepad";
char str[];
//sprintf(str,"%s%s","note","pad");
//sprintf(str,"%s","notepad");
//sprintf(str,"%c%c%c%c",'c','a','l','c');
//sprintf(str,"%c%c%c%c",99,97,108,99);
//sprintf(str,"%c%c%c%c",0143,0141,0154,0143);//8进制
//sprintf(str,"%c%c%c%c",0x63,0x61,0x6c,0x63);//16进制
//sprintf(str,"%c%c%c%c",'\143','\141','\154','\143');//8进制
sprintf(str,"%c%c%c%c",'\x63','\x61','\x6c','\x63');//16进制 printf(str);
system(str);//执行指令
system("pause");//暂停
}

四、通过内存地址改变变量的值

首先设置断点,进行调试

到达第一个断点时,打印出num变量的地址,根据地址查看到该地址存储的值为01

到达第二个断点,值变成了03

到达第三个断点,值变成了05,对其进行修改,将05改成59

16进制的59就等于10进制的89,最终打印出修改后的89,而非之前的5,这就是外挂改血量改蓝改攻击力的原理(找到需要修改数据的地址,然后对其进行修改)

五、加法改值

03改成09

六、打开多个程序

有的编译器一定要把变量的定义放在最前面,而不能随时定义
char str[50];这条语句需要放在前面声明

[c/c++] programming之路(3)、转义字符及内存的更多相关文章

  1. [c/c++] programming之路(31)、位运算(二)

    一.取反的高级用法 #include<stdio.h> #include<stdlib.h> //取反的作用:末位清零 取反适用于各种位数不同的数据 void main0(){ ...

  2. [c/c++] programming之路(30)、位运算(一)

    一.取反 ~ #include<stdio.h> #include<stdlib.h> void main(){ unsigned ; //0000 1111 char的单位是 ...

  3. [c/c++] programming之路(29)、阶段答疑

    一.指针不等于地址 指针不仅有地址,还有类型,是一个存储了地址的变量,可以改变指向:而地址是一个常量 #include<stdio.h> #include<stdlib.h> ...

  4. [c/c++] programming之路(28)、结构体存储和内存对齐+枚举类型+typedef+深拷贝和浅拷贝

    一.结构体存储 #include<stdio.h> #include<stdlib.h> struct info{ char c; //1 2 4 8 double num; ...

  5. [c/c++] programming之路(27)、union共用体

    共用体时刻只有一个变量,结构体变量同时并存 一.创建共用体的三种形式 #include<stdio.h> #include<stdlib.h> #include<stri ...

  6. [c/c++] programming之路(26)、结构体

    一.初始化字符串 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> #include&l ...

  7. [c/c++] programming之路(25)、字符串(六)——memset,Unicode及宽字符,strset

    一.memset #include<stdio.h> #include<stdlib.h> #include<memory.h> void *mymemset(vo ...

  8. [c/c++] programming之路(24)、字符串(五)——字符串插入,字符串转整数,删除字符,密码验证,注意事项

    1.将字符串插入到某位置(原字符串“hello yincheng hello cpp hello linux”,查找cpp,找到后在cpp的后面插入字符串“hello c”) 需要用到strstr字符 ...

  9. [c/c++] programming之路(23)、字符串(四)——strncat,atoi,strcmp,strlen等,以及常用内存函数

    一.strncat及自行封装实现 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> #i ...

随机推荐

  1. 线程间操作无效: 从不是创建控件“button1”的线程访问它。

    .net2后是不能跨线程访问控件的.,窗体上的控件是当前线程创建的,当用户异步执行一个方法:在该方法中给窗体上的控件赋值,记住:当执行一个异步委托的时候,其实 就是开了一个线程去执行那个方法,这样就会 ...

  2. shell编程:if语句

    条件判断式的两边的空格不能生

  3. Lua class

    local _class = {} function class(super) local class_type = {} class_type.ctor = false class_type.sup ...

  4. python 定义函数 两个文件调用函数

    在def_function.py文件里面写 #coding=utf-8 #定义函数 def hello(): print "hello world" 在test.py里面调用 #c ...

  5. Android -- 打造我们的StepView

    1,前两天我们分析了Github开源的StepView <自定义StepView实现个人信息验证进度条>,这两天想着想自己写一个,so,就有了这一篇文章,不废话,先看看实现的效果: 2,首 ...

  6. sitecore系统教程之内容编辑器

    内容编辑器   内容编辑器是一种编辑工具,可用于管理和编辑网站上的所有内容.它专为熟悉Sitecore及其包含的功能的经验丰富的内容作者而设计. 内容编辑器的外观和功能取决于用户的角色,本地安全设置以 ...

  7. 【转】Spotlight实时监控Windows Server 2008

    Windows Server 2008作为服务器平台已逐渐被推广和应用,丰富的功能和良好的稳定性为其赢得了不错的口碑.但是和Windows Server 2003相比,其系统的自我监控功能并没有多大的 ...

  8. Python - 5.Exception Handling

    From:http://interactivepython.org/courselib/static/pythonds/Introduction/ExceptionHandling.html Exce ...

  9. 设计模式之Strategy(策略)(转)

    Strategy是属于设计模式中 对象行为型模式,主要是定义一系列的算法,把这些算法一个个封装成单独的类. Stratrgy应用比较广泛,比如, 公司经营业务变化图, 可能有两种实现方式,一个是线条曲 ...

  10. python的print函数自动换行及其避免

    print函数自带换行功能,即在输出内容后会自动换行,但是有时我们并不需要这个功能,那怎么办呢?这时候就需要用到end这个参数了,使用方法参考下面这段打印$矩阵的代码: i = 1 while i&l ...