what is the difference between char * const and const char
*?

Answer Posted / brindha

Char* const p -> Here pointer P is a const pointer, which
means that this pointer can point to only one memory
location. eg. char* const p = &arr;
p++ ; -> This is invalid


const char* p -> this indicates that the data pointed by
the pointer p is constant & the value in that address
cannot be modified. eg. const char* p = 'a';
*p = 'b'; -> This is invalid

Is This Answer Correct ?    30 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are pragmas and what are they good for?

567


What does %p mean?

588


Can you add pointers together? Why would you?

637


Are the outer parentheses in return statements really optional?

570


What is the difference between a function and a method in c?

556






Is it possible to have a function as a parameter in another function?

594


What is the use of typedef in c?

577


find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }

1855


Explain how can a program be made to print the name of a source file where an error occurs?

682


Tell me when is a void pointer used?

642


What is file in c preprocessor?

646


How the c program is executed?

628


In this problem you are to write a program that will cut some number of prime numbers from the list of prime numbers between 1 and N.Your program will read in a number N; determine the list of prime numbers between 1 and N; and print the C*2 prime numbers from the center of the list if there are an even number of prime numbers or (C*2)-1 prime numbers from the center of the list if there are an odd number of prime numbers in the list.

1374


Can a pointer be null?

558


What is a global variable in c?

587