What is the output of the program? int n=f,m; n==m++; m==++n; printf(n, m);

This question is related to Wipro Interview

devansh

• Aug 12th, 2005

ans(f,f)

HAI

• Aug 28th, 2005

M,F+1

raj

• Sep 4th, 2005

m,m+1

Srinivas

• Dec 6th, 2005

I don't think the compiler would compile this without errors. What is f and what value would m take? that is just random.

And n==m++ is not assignment too. Its just logical comparison.

Please correct me if i am wrong.

Thanks

gourav

• Dec 24th, 2005

hi,

n==m++ is not an assingment,but it is a logical comparision.

int n=f,m;

int n==m++; // in this statement m is incremented to m+1//

int m==++n; //  in this statement n is incremented to f+1//

print(n,m);

ans: (f+1,m+1)

sachin

• Dec 26th, 2005

Hi,

Here f should ' f ' o/w compiler will give error as it will be considered as a variable........ it will assign the ASCII value of 'f ' to n i.e. 102 ......... then the values of m and n will be incremented by 1 so the output should be ................  103  1

ANISH

• Feb 14th, 2006

n=m++.......so the ascii value of m will increment and it will become n so now n=nnext step is m=++n. similarly here ascii value of n will increment .soans is m=om=o n=n

teju

• Mar 7th, 2006

i guess there are many problems in the question above first that f is not declared b4 and is directly assigned to n

and nxt the printf statement is given as print so we may come acrooss these two prob and hence this may not work

Shyamsundar

• Jun 7th, 2006

the progrm will not run bcoz compilation error occurs @ undefined symbl 'f'.

purani

• Jun 18th, 2006

first of all we cannot assign two value to the same variable as given n=f,m

the error occurs there itself so it results in compilation error

urmila

• Jun 24th, 2006

as both n,m are not assigned,i think n would be assigned to the ascii value of f and m to be zero.am i right??

ravi kiran

• Jun 27th, 2006

Hi friends i think it rises an error because it does not know the values f, m. so we get error undefined symbols f, m;

Ravi kiran

gopi

• Jul 20th, 2006

no o/p, only errors and warnings..

f needs to be declared in order to assign it and parameters do not match with the prototype of printf.. bla bla

rajesh

• Aug 21st, 2006

the above question shows an error here f is not declared.(==)code has noeffect to execute.the printfstatement is not displayed.it has no prototype.

Benazir

• Sep 26th, 2006

Hello..I feel the answer is that this will not work.
f is undefined.
printf statement should be rectified.
c ya.

Nitesh sharma

• Aug 29th, 2011

Error.

Dhiraj singh

• Oct 7th, 2011

n=f

n==m++
n==m+1

m==++n
m==1+n
m==1+m+1
m==2+m

output is " m+1 and m+2 "

Gopal27 Profile

• Jan 28th, 2012

Error bcoz there is no initilization of numeric value.

mathankumar

• Feb 1st, 2012

"n=m
m=1+n"

```Code"n=m
m=1+n"```

• Oct 12th, 2012

Error, undefinrd symbol f..

Iswarya Kriashnasamy

• Jan 24th, 2014

error,

K.Ravi kumar

• May 13th, 2015

1,1

K.Ravi Kumar

• May 13th, 2015

bcoz there they r used the relational operator
there they used two conditions if the conditions is true then it print 1 else 0.

sushila sonare Profile Answers by sushila sonare Questions by sushila sonare

• Jun 30th, 2017

ASCII value of f is 102 its assign to n,
n==m++ takes m default value/or random value depend on type of m ether its global or local. this instruction only dong comparison between n and m value then update m value, so its only given true or false value.
next instruction m==++n, its increment n value as 103 and compare with m, again its give Boolean value.
last instruction only print statement its print n and m value