*This solution is for the book I am currently reading. All of my notes and solutions are available at Google Code.*

Here is my work for problem 2.30 (my answer differs in form, but I believe is still correct, from the answer in the answer section:

Write a function with the following prototype: /* Determine whether arguments can be added without overflow */ int tadd_ok(int x, int y); This function should return 1 if arguments x and y can be added without causing overflow Answer: int tadd_ok(int x, int y) { int sum; sum = x + y; if (sum >= 0 && x < 0 && y < 0) { return 0; } if (sum 0 && y > 0) { return 0; } return 1; }