521 views
0 0 votes
1. const char *a;

      2. char* const a; 

      3. char const *a;

-Differentiate the above declarations.

2 Answers

1 1 vote
1. const char *a   :  a is a character pointer which is pointing to a constant character. It means value at address a can not be changed.

2. char * const a  : a is a character pointer which is pointing to a fixed address. It means a can not point to another address, but value at address a can be changed.

3. char const *a   : same as 1. (Pointer to a char const.). No semantic difference.
0 0 votes
1. const char *a;
- here 'a' is a pointer to a constant charecter 
2. char* const a;

-  here 'a' is a constant pointer to a charecter

 3. char const *a;

- same as 1

Position:
Show:

Related questions

3 3 votes
1 answers 1 answer
4.0k
4.0k views
Shivam Chauhan asked Oct 19, 2017
4,023 views
while(1) { flag[i] = true; while(flag[j]); /* Critical section */ flag[i] = false; /*Remainder section */ }Let flag is declared as Boolean flag and Pi denote one process...
1 1 vote
1 answers 1 answer
2.0k
2.0k views
7 7 votes
3 3 answers
338
338 views
GO Classes asked Jun 22
338 views
What is the output of the following code?#include <stdio.h int main() { int a[4] = {6, 4, 1, 2}; int b[8] = {9, 8, 11, 10, 5, 7, 0, 3}; int *p = &a ; int *q = b; int *r =...