C Programming - Const - Discussion
|
|
|
|
Read more:"The secret to creativity is knowing how to hide your sources."
- Albert Einstein
|
| 6. |
Point out the error in the program.
#include<stdio.h>
int main()
{
const int k=7;
int *const q=&k;
printf("%d", *q);
return 0;
}
|
| [A]. |
Error: RValue required | | [B]. |
Error: Lvalue required | | [C]. |
Error: cannot convert from 'const int *' to 'int *const' | | [D]. |
No error |
Answer: Option B
Explanation:
No error. This will produce 7 as output.
|
|
Mohini said:
(Tue, Jan 18, 2011 07:28:08 AM)
|
|
| |
| thats ok,as we are not changing the value of k |
|
|