RicardasSim icon

header version

RicardasSim | PRO | 04/09/20 07:18:10 PM UTC | 0 ⭐ | 695 👁️ | Never ⏰ | []
C |

660 B

|

None

|

0 👍

/

0 👎

/*
-std=c99 -Wall -Wextra -Wpedantic -Wshadow
 
test_incl.h
--------------------
 
#ifndef TEST_INCL_H
#define TEST_INCL_H
 
#define TEST_INCL_HEADER_VERSION 123 
 
#endif // TEST_INCL_H
 
another_incl.h
--------------------
 
#ifndef ANOTHER_INCL_H
#define ANOTHER_INCL_H
 
#include "test_incl.h"
 
#if TEST_INCL_HEADER_VERSION < 100
 
#define TEST_DEF 10
 
#elif TEST_INCL_HEADER_VERSION < 200
 
#define TEST_DEF 20
 
#else
 
#define TEST_DEF 30
 
#endif
 
#endif // ANOTHER_INCL_H
 
*/
 
#include <stdio.h>
#include <stdlib.h>
#include "another_incl.h"
 
int main()
{
 
    printf("%d\n", TEST_DEF);
 
    return 0;
}
 
/*
output:
 
20
 
*/

Comments