Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

Cpp Programming Quiz 50 – Which of the following is the correct way of declaring a function as constant?

Question: Which of the following is the correct way of declaring a function as constant?

[A]. const int ShowData(void) { /* statements */ }
[B]. int const ShowData(void) { /* statements */ }[C]. int ShowData(void) const { /* statements */ }

[D]. Both A and B 

Answer: Option C