What is the difference between a stack and a queue?

Queue Stack First item to be inserted is the first one to be removed. Allows access to only last item inserted. This mechanism is called First In First Out (FIFO). An item is inserted or removed from one end called the “top” of the stack. This is called Last In… Continue reading

Types of Variables in C Language & Rules for Constructing Variable Names

As we saw earlier, an entity that may vary during program execution is called a variable. Variable names are names given to locations in memory. These locations can contain integer, real or character constants. In any language, the types of variables that it can support depend on the types of… Continue reading

Rules for Constructing Character Constants

A character constant is a single alphabet, a single digit or a single special symbol enclosed within single inverted commas. Both the inverted commas should point to the left. For example, ’A’ is a valid character constant whereas ‘A’ is not. The maximum length of a character constant can be… Continue reading

Rules for Constructing Real Constants

Real constants are often called Floating Point constants. The real constants could be written in two forms—Fractional form and Exponential form. Following rules must be observed while constructing real constants expressed in fractional form: A real constant must have at least one digit. It must have a decimal point. It… Continue reading

What is the difference between realloc() and free()?

The free subroutine frees a block of memory previously allocated by the malloc subroutine. Undefined results occur if the Pointer parameter is not a valid pointer. If the Pointer parameter is a null value, no action will occur. The realloc subroutine changes the size of the block of memory pointed… Continue reading