Ad

Chapter - 6: Functions And Pointers

What will be the output of the following program:


Ad
A
Sections
1
Exercises

(a)

#include<stdio.h>
void display();
int main()
{
	printf("Learn C\n");
	display();
	return 0;
}
void display()
{
	printf("Followed by C++, C# and Java\n");
	main();
}

Output: 

Learn C
Followed by C++, C#, and Java
(infinite time)


(b)

#include<stdio.h>
int main()
{
	printf("C to it that C survives\n");
	main();
	return 0;
}

Output: C to it that C survives (infinite times.)


(c)

#include<stdio.h>
int check(int);
int main()
{
	int i = 45, c;
	c = check(i);
	printf("%d\n", c);
	return 0;
}
int check(int ch)
{
	if(ch >= 45)
		return (100);
	else
		return (10*10);
}

Output: 100

Ad

© 2024 Garbage Valuegarbage value logo