1. Question:What is the difference between calloc() and malloc() ? 

    Answer
    calloc(...) allocates a block of memory for an array of elements of a certain size. By default the block is initialized to 0. The total number of memory allocated will be (number_of_elements * size).
    
    malloc(...) takes in only a single argument which is the memory required in bytes. malloc(...) allocated bytes of memory and not blocks of memory like calloc(...).
    
    malloc(...) allocates memory blocks and returns a void pointer to the allocated space, or NULL if there is insufficient memory available.
    
    calloc(...) allocates an array in memory with elements initialized to 0 and returns a pointer to the allocated space. calloc(...) calls malloc(...) in order to use the C++ _set_new_mode function to set the new handler mode.

    1. Report
  2. Question:What are library Functions? 

    Answer
    Library Functions are predefined functions and stored in .lib files.

    1. Report
  3. Question:What is an argument? Differentiate between formal arguments and actual arguments? 

    Answer
    An argument is an entity used to pass the data from calling function to
    the called function. Formal arguments are the arguments available in
    the function definition. They are preceded by their own data types.
    Actual arguments are available in the function call.

    1. Report
  4. Question:What is prototype of printf function? 

    Answer
    Prototype of printf function is:
     int printf( const char *format ,…)

    1. Report
  5. Question:What is function recursion? 

    Answer
    When a function of body calls the same function then it is called as 'recursive function.'
    Example:
    Recursion()
    {
        printf("Recursion !");
        Recursion();
    }

    1. Report
  6. Question:Difference between pass by reference and pass by value? 

    Answer
    Pass by reference passes a pointer to the value. This allows the callee to modify the variable directly.Pass by value gives a copy of the value to the callee. This allows the callee to modify the value without modifying the variable. (In other words, the callee simply cannot modify the variable, since it lacks a reference to it.)

    1. Report
  7. Question:What is a function? 

    Answer
    A large program is subdivided into a number of smaller programs or subprograms. Each subprogram specifies one or more actions to be performed for the larger program. Such sub programs are called functions.

    1. Report
Copyright © 2024. Powered by Intellect Software Ltd