Skip to content
Snippets Groups Projects
Commit 3f4c1aba authored by 이장원's avatar 이장원
Browse files

C Preprocessor, Multiple file compile

parent 373d34ba
No related branches found
No related tags found
No related merge requests found
......@@ -44,37 +44,37 @@ b = f(20+13) // b = 1089
### etc.
* `#pragma once`
#pragma once를 사용하여 여러번 include하는 것을 방지할 수 있다.
* #pragma once
`#pragma once`를 사용하여 여러번 include하는 것을 방지할 수 있다.
* Token stringification
`#define <identifier>(<parameter>) #parameter`
* Token stringification
`#define <identifier>(<parameter>) #parameter`
#연산자는 token을 문자열 상수로 변환한다.
* Token concatenation
`#define <identifier>(<parameter>) parameter##string`
* Token concatenation
`#define <identifier>(<parameter>) parameter##string`
##연산자는 두 token을 하나로 연결하여 변환한다.
* Debuging macros
* Debuging macros
디버깅을 하면서 어느 부분에서 에러가 났는 지 알려준다.
* __FILE\_\_
* __FILE\_\_
에러가 발생한 파일 경로
* __LINE\_\_
* __LINE\_\_
에러가 발생한 라인
* __FUNCTION\_\_
* __FUNCTION\_\_
에러가 발생한 함수
# Multiple file compile
* func.h
```c
```
#define SQAURE(a) ((a)*(a))
extern int func(int a);
```
* func.c
```c
```
#include "func.h"
int func(int a)
......@@ -84,7 +84,7 @@ int func(int a)
```
* main.c
```c
```
#include <stdio.h>
#include "func.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment