logo

CuriousTab

CuriousTab

Discussion


Home Technical Questions Programming Comments

  • Question
  • In the following code in which order the functions would be called? a = ( f1 ( 23,14 ) * f2 ( 12/4) ) + f3() ;


  • Correct Answer
  • The order may vary from compiler to compiler Here the multiplication will happen before the addition , but in which order the functions would be called is undefined In an arithmetic expression the parentheses tell the compiler which operands go with which operators but do not force the compiler to evaluate everything within the parentheses first 


  • Programming problems


    Search Results


    • 1. What would be the output of the following program? main() { int i=2 ; printf ("\n%d%d", ++i, ++i ); }
    • Discuss
    • 2. What would be the output of the following program? main() { static int a[20]; int i = 0; a[i] = i++; printf ("\n%d%d%d", a[0], a[1], i); }
    • Discuss
    • 3. Point out the error, if any, in the following program. main() { int i = 4, j = 2; switch(i) { case 1 : printf (''\n To err is human, to forgive is against company policy."); break; case j : printf (''\n if you have nothing to do, don't do it here."); break; } }
    • Discuss
    • 4. Point out the error, if any, in the while loop. main() { int i = 1; while () { printf ( "%d", i++); if (i >10) break ; } }
    • Discuss
    • 5. Point out the error, if any, in the following program. main() { int ( *p )() = fun; ( *P ) (); } fun () { Printf ( "\nLoud and clear" ); }
    • Discuss
    • 6. Which error are you likely to get when you run the following program? main() { struct emp { char name[20]; float sal; }; struct emp e[10]; int i; for ( i = 0 ; i <= 9; i++) scanf ( "%s %f" , e[i].name, &e[i].sal ); }
    • Discuss
    • 7. What would be the output of the following program? main() { printf (" %d%d%d ", sizeof (3.14f), sizeof (3.14), sizeof (3. 141); }
    • Discuss
    • 8. What would be the output of the following program? main() { float a = 0.7; if ( a < 0.7f ) printf ( " C "); else Printf ( " C++ "); }
    • Discuss
    • 9. There is a mistake in the following code. Add a statement in it to remove it. main() { int a; a = f (10, 3.14) ; printf ( " %d ", a ); } f (int aa, float bb) { return ( ( float ) aa + bb ); }
    • Discuss
    • 10. Point out the error, if any, in the following program. main() { int a = 10; void f(); a = f(); printf ( "\n %d", a ); } void f() { printf ( "\n Hi "); }
    • Discuss


    Comments

    There are no comments.

Enter a new Comment