Chapter - 7: Data Types Revisited

What will be the output of the following program:


A
Sections
3
Exercises
#include<stdio.h>
int i = 0;
void val();
int main()
{
	printf("\nmain's i = %d", i);
	i++;
	val();
	printf("\nmain's i = %d", i);
	val();
	return 0;
}
void val()
{
	i = 100;
	printf("\nval's i = %d", i);
	i++;
}

Output: 

main's i = 0
val's i = 100
main's i = 101
val's i = 100


© 2021 Garbage Valuegarbage value logo