Ad

Chapter - 7: Data Types Revisited

What will be the output of the following program:


Ad
A
Sections
6
Exercises
#include<stdio.h>
int g(int);
int main()
{
	int i, j;
	for (i = 1; i < 5; i++)
	{
		j = g(i);
		printf("\n%d", j);
	}
	return 0;
}
int g(int x)
{
	static int v = 1;
	int b = 3;
	v += x;
	return (v + x + b);
}

Output:

6
9
13
18

Ad

© 2024 Garbage Valuegarbage value logo