Question: What is the difference between the following pointer declarations ? const int *ptr; int const *ptr; int *const ptr; const int *const ptr; Answer: Let me explain each with an example program. First:  int main( ) { int a = 6; const int *ptr;  // The value to which the pointer is pointing is read-only. […]

Read More




Conditional Compilation is a very important feature of C/C++ programming languages. Conditional compilation allows the compiler to skip over a part of the source code by inserting the preprocessing commands #ifdef, #else and #endif. The general form of using this is as follows: #ifdef macro_name statement_1; statement_2; #else statement_3; statement_4; #endif The above syntax says […]

Read More




This is a very famous question asked in C++ interviews especially, if you are an experienced professional. Let me repeat the question “What is the purpose of Aggregation ( or Composition ) in C++ ? Instead of building new software, Composition allows software to be developed by assembling existing components. Aggregation, which is mostly known as […]

Read More




The general way in which C programs are loaded into the memory is in the following format: When we compile a C Program, a final executable (i.e. in UNIX, traditional ‘a.out’) is created. This executable when executed is first loaded into the RAM by a program loader and the executable program is known as a […]

Read More