> For the complete documentation index, see [llms.txt](https://notes.tejpratapsingh.com/_/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.tejpratapsingh.com/_/cpp/code/pre-processors/pragma.md).

# #pragma

`#pragma` was introduced to remove dependency on [#ifdef](/_/cpp/code/pre-processors/ifdef.md) for solely including header file.

```cpp
// In myheader.h
#ifndef MYHEADER_H
#define MYHEADER_H

// Header contents go here

#endif // MYHEADER_H
```

Above, as we can see here we are using `#ifndef` for including header files only once, but here we need to declare a Macro = `MYHEADER_H` to chieve this.

To overcome this unnecessary creation of a Macro, we can use `#pragma once` which does the same thing without declaring any Macro.
