Answered Questions

  • Sequence of Function Execution

    printf("%d%d",f1(),f2());What is the sequence of function execution of the above statement. 1. printf, f1(), f2()2. printf, f2(), f1()3. f1(), f2(), printf4. f2(), f1(), printf.

    Star Read Best Answer

    Editorial / Best Answer

    mohinuddinkhan  

    • Member Since Oct-2009 | Oct 30th, 2009


    Let's understand this by going through the following code

    #include<stdio.h>
    int f1();
    int f2();

    void main()
     {
     printf("%dt%d",f1(),f2());
    }

    int f1()
    {
     printf("f1() enteredn");
     return 4;
    }

    int f2()
    {
     printf("f2() enteredn");
     return 5;
    }

    O/P-

    f2() entered
    f1() entered
    4        5

    we can conclude f2() is 1st executed
    then f1() and in the end printf().hence we can say the precedence of execution of functions are from right to left.

  • What is dangling pointer

    SURESH KUMAR KOLLIMALLA

    • May 10th, 2013

    By using dangling pointer we can access the values at the deallocated memory here, in the below code the memory allocated for variable n will be dealloeated as and when the control transfers from func...

    ishwar

    • Oct 19th, 2011

    Dangling pointers arise when an object is deleted or deallocated, without modifying the value of the pointer, so that the pointer still points to the memory location of the deallocated memory.