Review Questions
Assume all variables are of type int. Find the value of each of the following variables:
x = (2 + 3) * 6;
x = (12 + 6)/2*3;
y = x = (2 + 3)/4;
y = 3 + 2*(x = 7/2);
Assume all variables are of type int. Find the value of each of the following variables:
x = (int) 3.8 + 3.3;
x = (2 + 3) * 10.5;
x = 3 / 5 * 22.0;
x = 22.0 * 3 / 5;
You suspect that there are some errors in the next program. Can you find them?
int main(void) { int i = 1, float n; printf("Watch out! Here come a bunch of fractions!\n"); while (i < 30) n = 1/i; printf(" %f", n); printf("That's all, folks!\n"); return; }
Here's a first attempt at making min_sec interactive, but the program is not satisfactory. Why not? How can it be improved?
#include <stdio.h> #define S_TO_M 60 ...
Get C Primer Plus®, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.