三大基本类型(整型,浮点型,字符型)

局部变量

  1. #include <stdio.h>
  2. #include <tchar.h>
  3. int _tmain(int argc, _TCHAR* argv[])
  4. {
  5. //局部变量
  6. int nNum = 1;
  7. float fNum = 25;
  8. char ch = 'A';
  9. printf("int %d,float %f,char %c",nNum,fNum,ch);
  10. return 0;
  11. }

基本数据类型(2017_x64_debug).zip基本数据类型(2017_x64_release).zip基本数据类型(2017_x86_debug).zip基本数据类型(2017_x86_release).zip
image.png
test11111.zip

x86_debug:1234法找main函数

通过三个函数调用来获取三个参数,第一个是参数数量,第二个是参数数组,第三个环境变量地址数组地址
image.png
image.png

x86_release版本:23法找main函数

image.png

x64_debug:1234法

image.png
image.png

x64_release:23法

image.png
image.png

全局变量:

  1. #include <stdio.h>
  2. #include <tchar.h>
  3. //全局变量,静态变量
  4. int g_nNum = 1;
  5. static int g_nCount = 2;
  6. float g_fNum = 25;
  7. char g_ch = 'A';
  8. int _tmain(int argc, _TCHAR* argv[])
  9. {
  10. printf("int %d,float %f,char %c",g_nNum,g_fNum,g_ch);
  11. return 0;
  12. }

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法
image.png

复合数据类型(数组、结构体)

整型数据

  1. #include <stdio.h>
  2. #include <tchar.h>
  3. int _tmain(int argc, _TCHAR* argv[])
  4. {
  5. int nArr[5] = { 1,2,3,4,5 };
  6. int n = 2;
  7. nArr[n] = 20;
  8. return 0;
  9. }

x64_release.zipx64_debug.zip
x86_release.zipx86_debug.zip
test11111.zip
image.png

结构体

  1. #include <stdio.h>
  2. #include <tchar.h>
  3. struct MyStruct {
  4. int nNum;
  5. float fNum;
  6. char chA;
  7. };
  8. void Print(MyStruct stc) {
  9. printf("int %d,float %f,char %c", stc.nNum, stc.fNum, stc.chA);
  10. }
  11. int _tmain(int argc, _TCHAR* argv[])
  12. {
  13. MyStruct stc = { 1,2.2,'A' };
  14. stc.fNum = 5.5;
  15. Print(stc);
  16. return 0;
  17. }

x64_debug.zipx64_release.zip
x86_debug.zipx86_release.zip
test11111.zip
image.png

常量

  1. #include <stdio.h>
  2. #include <tchar.h>
  3. #define SIZE 100
  4. const int g_nCount = 1000;
  5. enum eData
  6. {
  7. enum_TYPE_1 = 1,
  8. enum_TYPE_1 = 2,
  9. enum_TYPE_1 = 3,
  10. };
  11. struct sData {
  12. int n;
  13. float fNum;
  14. char chA;
  15. };
  16. int _tmain(int argc, _TCHAR* argv[])
  17. {
  18. bool bRet = true;
  19. const int nCount = SIZE;
  20. const char* szHello = "Hello 15PB";
  21. const eData data = enum_TYPE_1;
  22. const float fNum = 1.5;
  23. const sData stc = { 1,2.0,'1' };
  24. return 0;
  25. }

x64_debug.zipx64_release.zip
x86_debug.zipx86_release.zip
test11111.zip
image.png
image.png

字符串

  1. #include <stdio.h>
  2. #include <tchar.h>
  3. int _tmain(int argc, _TCHAR* argv[])
  4. {
  5. char szStr[100] = { "szStr[100] Hello 15PB" };
  6. wchar_t szWchar[100] = L"szWchar Hello 15PB";
  7. char* szHello = "szHello* Hello 15PB";
  8. return 0;
  9. }

x86_debug.zipx64_release.zip
x64_debug.zipx86_release.zip
test11111.zip
字符数组
image.png
Unicode字符数组
image.png
字符串指针
image.png