C Programming - Typedef - Discussion

Discussion Forum : Typedef - General Questions (Q.No. 2)
2.
In the following code what is 'P'?
typedef char *charp;
const charp P;
P is a constant
P is a character constant
P is character type
None of above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
36 comments Page 2 of 4.

Rupinderjit said:   1 decade ago
p can't be pointer, since with typedef we can't modify the actual base type,we just only give new name to existing type. That's all folks.

Ravi said:   1 decade ago
const p;

The syntax itself having the keyword "const" which indicates the constant values.
(1)

Asd said:   1 decade ago
I think finally answer is p is a pointer to a character constant which is not in option so anwer is d.

Tulsiram said:   1 decade ago
typedef char *charp=> charp is character pointer
but
const charp P => P it is simply constant

Jethalal said:   5 years ago
@Pooja No, I think it should be a pointer to a character constant only.
(1)

Aiswarya said:   1 decade ago
Please tell me whether p is a character constant or simply a constant.

Deepak Agrawal said:   1 decade ago
P is a constant because it defines.

And it's a type of pointer type.

Kumaran said:   1 decade ago
P is the constant... It defined in the outside of main function.

Rocky said:   1 decade ago
p is constant or p is character constant???
please answer!!!!

Ana said:   1 decade ago
The answer is no clear to me. Can some one please explain.


Post your comments here:

Your comments will be displayed after verification.