三大基本类型(整型,浮点型,字符型)
局部变量
#include <stdio.h>
#include <tchar.h>
int _tmain(int argc, _TCHAR* argv[])
{
//局部变量
int nNum = 1;
float fNum = 25;
char ch = 'A';
printf("int %d,float %f,char %c",nNum,fNum,ch);
return 0;
}
基本数据类型(2017_x64_debug).zip基本数据类型(2017_x64_release).zip基本数据类型(2017_x86_debug).zip基本数据类型(2017_x86_release).zip
test11111.zip
x86_debug:1234法找main函数
通过三个函数调用来获取三个参数,第一个是参数数量,第二个是参数数组,第三个环境变量地址数组地址
x86_release版本:23法找main函数
x64_debug:1234法
x64_release:23法
全局变量:
#include <stdio.h>
#include <tchar.h>
//全局变量,静态变量
int g_nNum = 1;
static int g_nCount = 2;
float g_fNum = 25;
char g_ch = 'A';
int _tmain(int argc, _TCHAR* argv[])
{
printf("int %d,float %f,char %c",g_nNum,g_fNum,g_ch);
return 0;
}
x64_debug.zipx64_release.zip
x86_debug.zipx86_release.zip
test11111.zip
×86_debug:1234法找main函数
×86_release版本:23法找main函数
×64_debug:1234法
x64_release:25法
复合数据类型(数组、结构体)
整型数据
#include <stdio.h>
#include <tchar.h>
int _tmain(int argc, _TCHAR* argv[])
{
int nArr[5] = { 1,2,3,4,5 };
int n = 2;
nArr[n] = 20;
return 0;
}
x64_release.zipx64_debug.zip
x86_release.zipx86_debug.zip
test11111.zip
结构体
#include <stdio.h>
#include <tchar.h>
struct MyStruct {
int nNum;
float fNum;
char chA;
};
void Print(MyStruct stc) {
printf("int %d,float %f,char %c", stc.nNum, stc.fNum, stc.chA);
}
int _tmain(int argc, _TCHAR* argv[])
{
MyStruct stc = { 1,2.2,'A' };
stc.fNum = 5.5;
Print(stc);
return 0;
}
x64_debug.zipx64_release.zip
x86_debug.zipx86_release.zip
test11111.zip
常量
#include <stdio.h>
#include <tchar.h>
#define SIZE 100
const int g_nCount = 1000;
enum eData
{
enum_TYPE_1 = 1,
enum_TYPE_1 = 2,
enum_TYPE_1 = 3,
};
struct sData {
int n;
float fNum;
char chA;
};
int _tmain(int argc, _TCHAR* argv[])
{
bool bRet = true;
const int nCount = SIZE;
const char* szHello = "Hello 15PB";
const eData data = enum_TYPE_1;
const float fNum = 1.5;
const sData stc = { 1,2.0,'1' };
return 0;
}
x64_debug.zipx64_release.zip
x86_debug.zipx86_release.zip
test11111.zip
字符串
#include <stdio.h>
#include <tchar.h>
int _tmain(int argc, _TCHAR* argv[])
{
char szStr[100] = { "szStr[100] Hello 15PB" };
wchar_t szWchar[100] = L"szWchar Hello 15PB";
char* szHello = "szHello* Hello 15PB";
return 0;
}
x86_debug.zipx64_release.zip
x64_debug.zipx86_release.zip
test11111.zip
字符数组
Unicode字符数组
字符串指针