• RSS
  • Facebook
  • Twitter

Knowledge is Power.

  • Who you are ?

    Working on machines without understanding them ? Then you should be here..

  • Where you are ?

    Geographical location should not become a barrier to Share our knowledge.

  • What do you do ?

    Puzzles and Interview question are intended to be discussed here.

    Sunday, February 21, 2010

    This question was once asked me in an interview at BARC...

    Of course an expert can answer it with an elegance but not a fresher.
    The first answer would be 2 Bytes if a guy is working on Turbo C
    OR
    The answer can be 4 Bytes if he works on GCC
    OR
    Again it can be 4 Bytes if he has worked on java.


    So what to answer ?
    In this kind of question it makes sense to answer that the size depends upon the compiler untill ans unless they have specified the compiler.

    Now they can confuse a newbie by asking that
    Suppose if the pointer is of 2 Bytes and if we declare a pointer like this

    char *p;

    then what is the size ??

    Sounds silly but with so much tension in an interview even this confuses an fresher.

    So guys remember that in this case the "char" means that the the pointer points to an address this stores an char value but the value of pointer will be an integer.

    0 comments:

    Post a Comment