Sports GK Questions and Answers 2024 (Latest Updated)

Awards & Honours GK Questions 2024 (Latest Updated)

Question

What is wrong with the following function?

	int Main(int ac, char *av[])
	{
		if(ac==0) return 0;
		else
	{
	printf("%s", av[ac-1]);
	Main(ac-1, av);
	}
		return 0;
	}
	
A Function cannot have name as Main, it should be main only
B The arguments' name must be argc and argv, respectively
C There cannot be two return statements in the function
D There error in the function
Answer & Explanation
Option: [D]

There is no error in the function. Here the Main() function differenciate with the main(). In the given problem the Main() has two arguments as int ac, char *av[]

Advertisement
Article and Schedule Quiz Start Test!
DOWNLOAD CURRENT AFFAIRS PDF FROM APP

Random GK Questions

Assam Direct Recruitment Test Series

Computer Science Topics