Created: 2023-01-11 11:01
Status: #concept
Subject: Programming
Tags: C Expression Rvalue Macro Definition
Constant
A value that exists during compilation. It is typically used for Macro Definition and specific formulae.
C
We can assign constants to Variables or Macro Definitions:
int x = 3.14; // the constant number for PI
#define GRAVITY 9.8 // the Macro Definition for the Acceleration of Gravity
const
Keyword
Similar to JavaScript, C has the
const
type qualifier which declares objects as "read-only" values.
const
works on C Arrays, Pointer Variables, structs, andunion
types while Macro Definitions can't.