About 1,540,000 results
Open links in new tab
  1. shared c constants in a header - Stack Overflow

    place your variables in one file, declare them extern in the header and include that header where needed consider using some external tool to append '\' at the end of your macro definition

  2. 7.10 — Sharing global constants across multiple files (using ...

    Dec 14, 2024 · This lesson discusses the most common ways to do this. Global constants as internal variables Prior to C++17, the following is the easiest and most common solution: Create a header file …

  3. const (C++) | Microsoft Learn

    Mar 13, 2023 · In C, constant values default to external linkage, so they can appear only in source files. In C++, constant values default to internal linkage, which allows them to appear in header files.

  4. Static const variable declaration in a header file

    Typically, you should declare variables in C files and create extern definitions for them in header files. How do you define a constant in a header file? You need to do: to make a constant pointer, so that …

  5. const (GNU C Language Manual)

    After this definition, the code can use the variable pi but cannot assign a different value to it. pi = 3.0; /* Error! */ Simple variables that are constant can be used for the same purposes as enumeration …

  6. Constants in C - GeeksforGeeks

    Nov 1, 2025 · In C programming, const is a keyword used to declare a variable as constant, meaning its value cannot be changed after it is initialized. It is mainly used to protect variables from being …

  7. C Header Files: Declaring Shared Functions and Variables

    Sep 6, 2024 · Learn how to use C header files to declare shared functions and variables in your programs. This guide covers syntax, best practices, and practical examples.

  8. Define constant variables in C++ header - Stack Overflow

    For C++ header files you should use .hpp file format to differentiate from C header files which are in .h format.