# Is there a method to use preprocessor like h file in C/C++?

**URL:** <https://discourse.nodered.org/t/is-there-a-method-to-use-preprocessor-like-h-file-in-c-c/54960>\
**Category:** General\
**Created:** [9 December 2021 20:14 UTC](https://discourse.nodered.org/t/is-there-a-method-to-use-preprocessor-like-h-file-in-c-c/54960 "2021-12-09T20:14:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![corso66](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/corso66/32/41143_2.png) [@corso66](https://discourse.nodered.org/u/corso66)\
**Post date:** [9 December 2021 20:14 UTC](https://discourse.nodered.org/t/is-there-a-method-to-use-preprocessor-like-h-file-in-c-c/54960/1 "2021-12-09T20:14:30Z")

</div>

Hi !

I want to use a technic with JS like .h file in C/C++ and definitively, modify any label at a only one file or node...

For exemple, if i have an array from buffer IoT named `o[]` with 100 values ; in C, i will put in my header .h file :

```auto
#define temp1 o[0]
#define temp2 o[1]
#define temp3 o[2]
#define temp4 o[3]
...
#define temp100 o[99]

```

I found on the web this 'map' object :

```auto
map = {
    1: "FISH",
    2: "CHIPS",
    3: "EAT",
    4: "SLEEP",
    5: "CODE",
}
input = 5
alert(map[5]) // Will alert CODE, as required.

```

How can i adapt my case and if possible, where can i add this code ? 🤔

Thank you very much,

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [9 December 2021 21:31 UTC](https://discourse.nodered.org/t/is-there-a-method-to-use-preprocessor-like-h-file-in-c-c/54960/2 "2021-12-09T21:31:10Z")

</div>

Read up on node,js modules. They are files containing code, some or all of which you "export". When you "require" such a module in another node.js file, node.js imports the exported code & values.

---

<div class="post-metadata">

**Author:** ![corso66](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/corso66/32/41143_2.png) [@corso66](https://discourse.nodered.org/u/corso66)\
**Post date:** [13 December 2021 21:02 UTC](https://discourse.nodered.org/t/is-there-a-method-to-use-preprocessor-like-h-file-in-c-c/54960/3 "2021-12-13T21:02:44Z")

</div>

ok thank you, i will see that 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [11 February 2022 21:02 UTC](https://discourse.nodered.org/t/is-there-a-method-to-use-preprocessor-like-h-file-in-c-c/54960/4 "2022-02-11T21:02:46Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
