Chapter - 6: Functions And Pointers

What will be the output of the following program:


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


© 2021 Garbage Valuegarbage value logo