A variable declaration in C specifies the type of the variable and its name, allowing the compiler to allocate the appropriate amount of memory.
age
in C?int age;
height
in C?float height;
initial
with the value 'A'?char initial = 'A';
A function declaration, also known as a function prototype, specifies the function's name, return type, and parameters, allowing the compiler to check the function calls for correctness.
add
that takes two integers and returns an integer?int add(int, int);
scores
?int scores[10];
ptr
?int *ptr;
A structure declaration defines a new data type that groups variables of different types under a single name.
Person
with name
(char array) and age
(int) as its members?struct Person {
char name[50];
int age;
};
Person
named person1
?struct Person person1;
MAX_SIZE
with a value of 100?const int MAX_SIZE = 100;
An enumeration declaration defines a set of named integer constants, providing a way to assign names to integral constants to make a program easier to read and maintain.
Color
with values RED
, GREEN
, and BLUE
?enum Color {
RED,
GREEN,
BLUE
};
Color
named favoriteColor
?enum Color favoriteColor;