First you have to install MinGW32
In fact, it is good to match the environment variables, specifically to Baidu!
Enter me to write you look at the pattern
MIAN.C file
#include <stdio.h>#include "b.h" int main () {int m = 5; int n = 6; int result = B (m,n);p rintf ("Hello \ n ");}
#endif
B.C file
#include "B.h"
int b (int a, int b) {
Return a- b;}
B.h header File
Prevent file duplicate references, that is, two files are used on this header file
#ifndef B_header
#define B_header
int b (int a,int b);
#endif
Well, let me tell you what the # include <stdio.h> is about #是 prep.
What about here? Use the Stdio.h (System function) <> this to import # include
"B.h" in the B.h with "" "import, because you wrote it!
1.-C Compile as target file
2.-E only for preprocessing
3.-O to set the generated file
Use that gcc- c main.c- o main.o to write main.c into a 2 binary MAIN.O file
compile with GCC main.c B.C
1. header files can not be compiled
2. You can view the specific statement
3. The header file plus the implementation file of the O file submitted to the user, do not need to know the source code
4.o files are precompiled, so the compilation time is greatly improved when the whole project is compiled.
5. When a file (A.C file) is dependent on the header file (b.h), A.O files do not need to be recompiled if the B.O files formed after B.C compilation are recompiled
Define constants, Structure bodies
#include <stdio.h> #define PI 3.14//Constant # define area (A, b) a*b;//typedef usage is equivalent to an alias typedef int CJ;//struct type data struc T person {int age;float height};//generally only once struct {int age;float height}person;//type typedef struct emp{int age ;} employee,//typedef struct{int age ;} Employee;
int main () {
int m = 5;
int n = 6;
CJ A=5;
int arry[] ={1,2,3};
Take the structure of the body
struct person p1;
With structural body
p1.age=20;
}
Stack: Stack advanced after the storage data, the space is unchanged
Heap: Hoop memory Area storage data for a long time, the data is large, can be dynamically increased,
C-language structure, constants, and compilation of an executable file