What is a const pointer?

What is a const pointer?

A const pointer is not the pointer to constant, it is the constant. For example, int* const ptr; indicates that ptr is a pointer, which is a constant. A pointer is preceded by ‘*’. In the above example it is not, Hence it is not the pointer to constant.

The ptr can not be used to point to another integer. The integer pointed by ptr can be changed. The const pointer can not be changed to point to other memory location, because the pointer is constant
Explain memory leak
An unwanted increase in programs is referred as a memory leak is C language...
What is static memory allocation and dynamic memory allocation?
Static Memory Allocation: Memory is allocated for the declared variable by the compiler....
Purpose of main() function
The function main() calls / invokes other functions within it. The execution of the program always starts with main() function.....
Post your comment