About 975,000 results
Open links in new tab
  1. Define constant variables in C++ header - Stack Overflow

    A program I am working on has many constants that apply throughout all classes. I want to make one header file "Constants.h", and be able to declare all the relevant constants. Then in my other cla...

  2. Constants in C Explained – How to Use #define and the const ...

    Oct 26, 2021 · When you're programming, there are times when you'll want the values of certain variables to remain unchanged. In the C language, you'll likely define them as constants. You can …

  3. Constants in C - GeeksforGeeks

    Nov 1, 2025 · We define a constant in C using the const keyword. Also known as a const type qualifier, the const keyword is placed at the start of the variable declaration to declare that variable as a constant.

  4. 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 …

  5. #define for constants? - C++ Programming

    You DECLARE extern global variables in the header file. You DEFINE the same variables and initialize the const variables in One .c file, and then use them in any .c file that #includes the header file. …

  6. C Coding Standards - UMass Boston CS

    All functions, constants, and types that are intended to be used outside the file should be declared in a header file. Static functions, file-local constants and types should be declared at the top of the .c file.

  7. 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

  8. c - Static const variable declaration in a header file ...

    Aug 12, 2016 · If I declare static const variable in header file like this: static const int my_variable = 1; and then include this header in more than one .c files, will compilator make new instance per each fi...