Online GK Series

This site is dedicated to the aspirants of competitive exams SSC, UPSC, Railways, Postal Assistants, Bank, GATE and NET

3,00,000 Jobs Waiting For You

Q.

Consider the following program:

	main()
	{
		char *x="xyz;
		f(k);
		printf("%s\n",k);
	}
	f(char *k)
	{
		k=malloc(4);
		strcpy(k,"pq");
	}
	

What will be the output?

A pq
B xyz
C syntax error
D none of these
Answer & Explanation
Option: [C]

There is an opening quote in the third statement but no closing. So syntax error occurs.

mcq on c programming functions 01

Your Valuable Comments Please...

Useful Computer Science EBooks