Syntax

C Declare Variables Syntax

In C, declare variables: declares typed variables — int n = 0; double x = 1.5; char c = 'a';

Quick Answer

Syntax
int n = 0; double x = 1.5; char c = 'a';
CSyntax

Declare Variables

Code example
int n = 0; double x = 1.5; char c = 'a';

Declares typed variables.

Learn More

How to declare variables in C

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

C Declare Variables Syntax

Use int n = 0; double x = 1.5; char c = 'a';.

Related Syntax References

Frequently asked questions

What is the C syntax for declare variables?

Use this pattern: int n = 0; double x = 1.5; char c = 'a';

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