Can this be considered a design flaw,
or a regular exception ??
Code:int a = -2147483648; int b = ~a; b = 1 + b; printf("%d\n", a); /* Prints -2147483648. */ printf("%d\n", b); /* Also prints -2147483648. */
Can this be considered a design flaw,
or a regular exception ??
Code:int a = -2147483648; int b = ~a; b = 1 + b; printf("%d\n", a); /* Prints -2147483648. */ printf("%d\n", b); /* Also prints -2147483648. */
Neither.
Study Two's Complement Arithmetic
If you do not understand a particular context,
just don't add your half-formed opinion..
How do you know what I did not study,
did you examine my lab papers back then ??
Well that didn't take long.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.