C Programming - Const - Discussion

Discussion Forum : Const - Point Out Errors (Q.No. 4)
4.
Point out the error in the program.
#include<stdio.h>
const char *fun();

int main()
{
    char *ptr = fun();
    return 0;
}
const char *fun()
{
    return "Hello";
}
Error: Lvalue required
Error: cannot convert 'const char *' to 'char *'.
No error and No output
None of above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
21 comments Page 3 of 3.

Abhishekppardeshi said:   1 decade ago
I think the fun() never gets called.


Post your comments here:

Your comments will be displayed after verification.