Syntax

C Define a Constant Syntax

In C, define a constant: defines a constant value — #define MAX 100 const int LIMIT = 10;

Quick Answer

Syntax
#define MAX 100 const int LIMIT = 10;
CSyntax

Define a Constant

Code example
#define MAX 100 const int LIMIT = 10;

Defines a constant value.

Learn More

How to define a constant in C

  1. Open your C file or editor.
  2. Copy the example, then replace its sample names and values for your code.

C Define a Constant Syntax

Use #define MAX 100 const int LIMIT = 10;.

Related Syntax References

Frequently asked questions

What is the C syntax for define a constant?

Use this pattern: #define MAX 100 const int LIMIT = 10;

Can I copy this C code example?

Yes. Use Copy code and adapt the example to your program.

Is this C syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify