Home » C Programming » Functions » Question
  1. Which of the following is the correct output for the program given below?
    #include <stdio.h>
    int main ( )
    {
    int p = 1 ;
    if ( !p )
    printf ("Learning C is painful\n" ) ;
    else
    {
    p = 0 ;
    printf ("Learning C is challenging\n");
    main ( ) ;
    }
    return 0 ;
    }
    1. Learning C is challenging
      Learning C is painful
    2. Learning C is painful
      Learning C is challenging
    3. Learning C is real pain !
    4. Learning C is challenging
    5. The code prints
      Learning C is challenging
      Learning C is challenging (infinitely..... )
Correct Option: E

else condition will be true for forever so

The code prints
Learning C is challenging
Learning C is challenging (infinitely..... )



Your comments will be displayed only after manual approval.