Ask your own question, for FREE!
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW) 8 Online
OpenStudy (anonymous):

can anybody please explain what will be the output of the following program....and why the output is so ? #include int main() { int k,a=1,b=2; k= (a,b); printf("%d",k); return 0; }

OpenStudy (e.mccormick):

Looks like C type stuff. MIT 6.189 is a Python class. The main Computer Science might be a slightly better choice, but at least this sub topic also shows there.

OpenStudy (rsmith6559):

I would expect that this program wouldn't compile because k= (a,b); doesn't look like anything that can be done with integers and assigned to an integer.

OpenStudy (e.mccormick):

It will compile. And run.

OpenStudy (anonymous):

what is the output for the program???

OpenStudy (e.mccormick):

Try it ans see.

OpenStudy (marsbcn):

returns the value of b. why? check this http://en.wikipedia.org/wiki/Comma_operator

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!