These are the few pointer i made while i myself was preparing for C/C++ interviews. You might want to get these facts right into your mind as well, beware you might be asked some question based on these facts in the interview.
Please do comment what you feel about these? Do you agree with these?
If you have some more pointers to share with puzzlersworld.com user’s, please don’t hesitate.
Some Facts on C/C++
- Functions defined in a class are by default inline.
- Memory space for the members of a class is allocated when an object of that class is created, not before that(at declaration of the class).
- Compiler provides a zero argument constructor only when there is no other constructor defined in the class.
- Realloc can be used to reallocate the memory allocated using new operator.
- Size of the pointer does not depend on where it is pointing to, it is always the same.
- Copy constructor and assignment operators are provided by default by the compiler.
- When an object is passed or returned to/from a function by value the copy constructor gets called automatically.
- For a template function to work it is mandatory that its definition should always be present in the same file from where it is called.
- All static data members are initialized to zero.
- For every static data member of a class it should also be defined outside the class to allocate the storage location.
Subjective Question set C/C++ – Part 1