What will be the output of the following C code?
#include < stdio.h >
#define foo(m, n) m ## n
int main()
{
printf(“%s\n”, foo(k, l));
}
a) k l
b) kl
c) Compile time error
d) Undefined behaviour
Answer: c
Related Posts
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
long factorial (long a)
{
if (a > 1)
return (a * factorial (a + 1));
else
return (1);
}
int main ()
{
long num = 3;
cout << num << “! = ” << factorial ( num );
return 0;
}What will be the new value of x in the following C++ code?
#include <iostream>
using namespace std;
void fun(int &x)
{
x = 20;
}
int main()
{
int x = 10;
fun(x);
cout << “New value of x is ” << x;
return 0;
}What will be the output of the following C++ code?
#include <iostream>
using namespace std;
void copy (int& a, int& b, int& c)
{
a *= 2;
b *= 2;
c *= 2;
}
int main ()
{
int x = 1, y = 3, z = 7;
copy (x, y, z);
cout << “x =” << x << “, y =” << y << “, z =” << z;
return 0;
}By default how the value are passed in c++?
Which is used to keep the call by reference value as intact?
How many ways of passing a parameter are there in c++?
Which of the following is important in a function?
Join The Discussion