What is a const pointer, and how does it differ from a pointer to a const?
Answer Posted / nashiinformaticssolutions
1. Pointer to const: The value being pointed to cannot be modified, but the pointer itself can change.
Example:
2. const int a = 10;
3. const int *ptr = &a; // *ptr is read-only
4. const pointer: The pointer cannot change, but the value it points to can.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are 3 types of structures?
What is difference between structure and union with example?
List some of the static data structures in C?
How do you do dynamic memory allocation in C applications?
Write a program to swap two numbers without using a temporary variable?
What is pointer & why it is used?
What is the advantage of an array over individual variables?
write a program for the normal snake games find in most of the mobiles.
Without Computer networks, Computers will be half the use. Comment.
What are reserved words?
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
What is the difference between mpi and openmp?
Why main is used in c?
What is the correct declaration of main?