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

why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???

1502


why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

644


What is volatile keyword in c?

567


What is the difference between declaring a variable and defining a variable?

708


What does %p mean?

576






Write a program to maintain student’s record. Record should not be available to any unauthorized user. There are three (3) categories of users. Each user has its own type. It depends upon user’s type that which kind of operations user can perform. Their types and options are mentioned below: 1. Admin (Search Record [by Reg. No or Name], View All Records, Insert New Record, Modify Existing Record) 2. Super Admin (Search Record [by Reg. No or Name], View All Records, Insert New Record, Modify Existing Record, Delete Single Record) 3. Guest (Search Record [by Reg. No or Name], View All Records) When first time program runs, it asks to create accounts. Each user type has only 1 account (which means that there can be maximum 3 accounts). In account creation, following options are required: Login Name: <6-10 alphabets long, should be unique> Password: <6-10 alphabets long, should not display characters when user type> Confirm Password: Account Type: Login Name, Password and Account Type should be stored in a separate file in encrypted form. (Encryption means that actual information should be changed and Decryption means that Encrypted information is changed back to the actual information) If any of the above mentioned requirement(s) does not meet then point out mistake and ask user to specify information again. When Program is launched with already created accounts, it will ask for user name and password to authenticate. On successful authentication, give options according to the user’s type.

1499


What is the difference between #include

and #include “header file”?

538


Why isnt there a numbered, multi-level break statement to break out

573


What is meant by operator precedence?

660


Is using exit() the same as using return?

666


What does malloc () calloc () realloc () free () do?

546


Can main () be called recursively?

613


Why do we use return in c?

554


What is switch in c?

632


diff between exptected result and requirement?

1588