Chapter - 7: Data Types Revisited

What will be the output of the following program:


A
Sections
7
Exercises

A

B

C

1

2

3

4

5

6

7

8

#include<stdio.h>
void func();
int main()
{
	func();
	func();
	return 0;
}
void func()
{
	auto int i = 0;
	register int j = 0;
	static int k = 0;
	i++; j++; k++;
	printf("\n %d % d %d", i, j, k);
}

Output: 

1 1 1
1 1 2

While in some compilers (like Visual Studio), using auto as type-specifier may result in an error.


© 2020 Garbage Valuegarbage value logo