Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

In C the direction of truncation for / and the sign of the result for % are machine-dependent for negative operands, as is the action taken on overflow or underflow. Can someone give me an example?

OpenStudy (anonymous):

http://en.wikipedia.org/wiki/Two%27s_complement

OpenStudy (anonymous):

That's not really an example. I know two's compliment, I know machines have varying size for int, short int etc. and that padding the left side will make a once negative number positive (although I don't know much more than that) but I don't see the case for all of this in regards to / and %

OpenStudy (anonymous):

They are saying that it's up to the people who wrote the compiler to decide which of these is true: 17 % -3 = 2 17 % -3 = -2 If you run code on one machine, the first might be true (most modern compilers), and on some other computer from a different manufacturer and with a compiler which never decided one way or the other, the second might be true (non C99 compliant compiler)

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!