17

Find the odd one out :

a) const int * foo
b) int const * foo
c) const * int foo
d) int * const foo

Comments
  • 6
    😂 good one 😁
    c: Pointer to a const ?!?
  • 2
    I had to check b lol have never put it the opposite way round before 😂 learn something new every day.
  • 0
    Actually the odd one is "const int*" since it breaks the rule that const is applied to the element immediately to its left. const is a postfix operator
  • 0
    @elazar well, that also is the case for c), which also happens to be the only whose syntax is invalid
  • 0
    @elazar sorry to ruin your world, but that's completely legal and actually quite helpful
  • 0
    @yfede right. There are two reasonable and one illegal examples ☺
  • 1
    C... All the rest need 2 pen strokes to write...
Add Comment