c生成可执行文件的过程
首先通过源代码翻译成目标代码,各类目标代码、库等最终通过链接器捆绑在
一起从而生成可执行文件
执行
可执行文件载入内存中便开始执行,在大多数的机器中,程序运行时将使用一个运行时stack(堆栈),存储函数的局部变量和返回地址,静态(static)变量存储于静态内存中,在程序整个生命周期中存活。
注释
单行注释使用//
多行注释使用/**/
标识符
课后习题
2.7-4
#include "stdafx.h"
#include "stdlib.h"
int main()
{
printf("%c %c %c %c\n", '\40','\100','\x40','\0123');
system("pause");
return 0;
}
2.8-1
main.cpp
#include "stdafx.h"
#include "function.h"
#include "stdlib.h"
int main()
{
printf("10 of Result: %d %d\n", negate(10), increment(10));
printf("0 of Result: %d %d\n", negate(0), increment(0));
printf("-10 of Result: %d %d\n", negate(-10), increment(-10));
system("pause");
return 0;
}
increment.cpp
#include "stdafx.h"
int increment(int a)
{
return a+1;
}
negate.cpp
#include "stdafx.h"
int negate(int a)
{
return -a;
}
function.h
#pragma once
#ifndef test
#define test
int negate(int a);
int increment(int a);
#endif