Wednesday, February 25, 2015

How many levels of pointers can you have?

Question:How many levels of pointers can you have??

Answer: </I>The answer depends on what you mean by "levels of pointers." If you mean "How many levels of indirection can you have in a single declaration?" the answer is "At least 12." int i = 0; int *ip01 = &amp; i; int **ip02 = &amp; ip01; int ***ip03 = &amp; ip02; int ****ip04 = &amp; ip03; int *****ip05 = &amp; ip04; int ******ip06 = &amp; ip05; int *******ip07 = &amp; ip06; int ********ip08 = &amp; ip07; int *********ip09 = &amp; ip08; int **********ip10 = &amp; ip09; int ***********ip11 = &amp; ip10; int ************ip12 = &amp; ip11; ************ip12 = 1; /* i = 1 */ The ANSI C standard says all compilers must handle at least 12 levels. Your compiler might support more.

Tags:Interview Questions, Languages, C,

Please submit your Interview Answer for the above Question via replying to this post. Thank you for visiting to our blog, Have a Good Day!.



Sponsor Advertisement



Real Estate Management Software

Real Estate Management System Software

Real Estate Management Software is an advanced end-to-end Real Estate Office Management System that enables Real Estate Agencies to manage more effectively, search prorty details, keep property owner data etc. Web-based tracking and accounting solution ideal for commercial, residential housing....

No comments:

Post a Comment