Skip to content

Commit 99ea353

Browse files
committed
Using include guards and the undef directive
1 parent eb85c4e commit 99ea353

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

The Preprocessor/Include guards and undef directive/using_include_guards.c

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#ifndef _USING_INCLUDE_GUARDS_H
2+
#define _USING_INCLUDE_GUARDS_H //when other file.h will use #include "using_include_guards.h" it will load this file only once, cause at a subsequent inclusing it is already activated
3+
#include <stdio.h>
4+
#endif
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <stdio.h>
2+
3+
4+
int main(void)
5+
{
6+
7+
8+
9+
return 0;
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef _USING_UNDEF_H
2+
#define _USING_UNDEF_H
3+
4+
#define UNIX
5+
#undef UNIX
6+
7+
8+
#endif

0 commit comments

Comments
 (0)