What is a variable declaration in C?

A variable declaration in C specifies the type of the variable and its name, allowing the compiler to allocate the appropriate amount of memory.

How do you declare an integer variable named age in C?

int age;

How do you declare a float variable named height in C?

float height;

How do you declare and initialize a character variable named initial with the value 'A'?

char initial = 'A';

What is a function declaration in C?

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.

How do you declare a function named add that takes two integers and returns an integer?

int add(int, int);

How do you declare an array of 10 integers named scores?

int scores[10];

How do you declare a pointer to an integer named ptr?

int *ptr;

What is a structure declaration in C?

A structure declaration defines a new data type that groups variables of different types under a single name.

How do you declare a structure named Person with name (char array) and age (int) as its members?

struct Person {
    char name[50];
    int age;
};

How do you declare a variable of type Person named person1?

struct Person person1;

How do you declare a constant integer named MAX_SIZE with a value of 100?

const int MAX_SIZE = 100;

What is an enumeration declaration in C?

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.

How do you declare an enumeration named Color with values RED, GREEN, and BLUE?

enum Color {
    RED,
    GREEN,
    BLUE
};

How do you declare an enum variable of type Color named favoriteColor?

enum Color favoriteColor;