==================================================================================
1.while语句的特殊应用
int a=8;
while(a=a-1);
printf("%d/n",a);
==================================================================================
2.续行符。注意符号“/”的特殊应用。可实现分行。
例如:
printf("kdjfiejf/
isjidf");
以下这种分行也是允许的。
printf("%d%d%d%d /n",
a,
b,
c,
d);
==================================================================================
3.char数组可以分行初始化。
char shellcode[] =
"/x31/xc0/xb0/x46/x31/xdb/x31/xc9/xcd/x80/xeb/x16/x5b/x31/xc0"
"/x88/x43/x07/x89/x5b/x08/x89/x43/x0c/xb0/x0b/x8d/x4b/x08/x8d"
"/x53/x0c/xcd/x80/xe8/xe5/xff/xff/xff/x2f/x62/x69/x6e/x2f/x73"
"/x68";
==================================================================================
4.typedef的特殊应用,定义函数指针。
例如:
typedef BOOL(WINAPI*MYFUNC)(HWND,COLORREF,BYTE,DWORD);
则MYFUNC就是一个函数指针了。
==================================================================================
5.在for循环中定义一个变量后,其作用域不止在for循环内!!!!!!!!!
for( int i = 0; i < 4; i++ )
{
printf("i的值%d/n",i);
}
if( i >= 4 )
{
printf("i仍有效,此时i的值为:%d/n",i);
}
==================================================================================
6.strlen与sizeof的区别。
#include <stdio.h>
#include <string.h>
char buf[]="abc";
int a,b;
a = strlen(buf);
b = sizeof(buf);
printf("a=%d,b=%d/n",a,b);
结果:a=3,b=4
还有如果有:
char buf[3];
则sizeof(buf)的值为3,而strlen(buf)的值是不确定的。
若:char buf[3]="";
则sizeof(buf)的值仍旧为3,而strlen(buf)的值为0。
==================================================================================
7.字符串数组的初始化。
char buf[8]={"0"}; //初始化后buf数组的值为 0
char buf[8]={0}; //初始化后buf数组的值为 空
==================================================================================