Following declarations are different from one anotherconst char *const s; char const *const s;

A) True
B) False

Showing Answers 1 - 8 of 8 Answers

paulson paul chambakottukudyil

  • Apr 20th, 2006
 

There is no difference between the two declarations.

  Was this answer useful?  Yes

Yes, there is no difference between two declaration, both are same.

1)       const  char *const  s;
             (i)               (ii)

Here 1st const is placed before *. That indicates the character value is constant.  Secondly,  const is placed before s. that indicates the pointer is constant which in turn points to a const character.
So, s is a constant pointer points to a constant character.

2)     char const  *const  s;
                  (i)         (ii)
Here also 1st const is placed before *. That indicates the character value is constant.  secondly, constant is placed before s which indicates the pointer is constant as in the first case. this constant pointer s in turn points to an constant character.
so here also, s is a  constant pointer points to a constant character.

Thus, Both the declarations are same and there effect are also same.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions