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.

      • loading tweets

    Sunday, March 28, 2010

    Namespaces Namespaces allow to group entities like classes, objects and functions under a name. This way the global scope can be divided in "sub-scopes", each one with its own name.The format of namespaces is:namespace identifier{ entities}Where identifier is any valid identifier and entities is the set of classes, objects and functions that are included within the namespace. For example:1234 namespace myNamespace{int a, b;}In ...

    Monday, March 8, 2010

    The C preprocessor is a program that processes our source program before it is passed to the compiler.preprocessor is a separate program which transforms C source code containing preprocessor directives into source code with the directives removed.The preprocessor is implemented as an integral part of an Standard C compiler.gcc -E filename will show...
    1.Macro Expansion: * C preprocessor provides a facility for defining constant and substitution,which are commonly called macros. * Macros are used when we want to make a program more readable or when we dont have enough information about certain values. * A macro definition has the form #define name replacement text * The statement above define a macro and some replacement text.The preprocessor will replace the name with the replacement...
    Operators in Preprocessor: * The 2 operators used in the preprocessor are 1. # 2. ##1.# operator: * If the macros are present with in the quoted strings it is not replaced by the #defined macro. * But if the macroname is preceded by a # then the macro is expanded into a quoted string with the parameter replaced by the actual argument * Eg: #include #define toprint(expr) printf(#expr "=%d\n",expr) int main() { int...
    1.What is the output of the following program?#include#define clrscr() 10int main(){ printf("result=%d\n",clrscr()); return 0;}result=10#defines are used for textual replacement2.What is the output of the following program?#include#define fun(f1,f2) f1##f2int main(){ int some100=100; printf("result=%d\n",fun(some,100)); return 0;}Solutionresult=100To know about the ## operator Click here3.What is the output of the following program?#include#define...