Functions
- 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 ;
}
-
View Hint View Answer Discuss in Forum
else condition will be true for forever so
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..... )
- Which of the following is the correct output for the program given below?
#include <stdio.h>
void function1 (char*) ;
int main ( )
{
char ch[100] ;
ch[0] = 'A' , ch[1] = 'B' ;
ch[2] = 'C' , ch[3] = 'D' ;
function1 ( &ch[0] );
return 0 ;
}
void function1 (char*ch);
{
ch++ ;
printf ("%c" , *ch) ;
ch++ ;
printf ("%c\n" , *ch);
}
-
View Hint View Answer Discuss in Forum
BC
Correct Option: B
BC