about summary refs log tree commit diff stats
path: root/1.2.c
diff options
context:
space:
mode:
Diffstat (limited to '1.2.c')
-rw-r--r--1.2.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/1.2.c b/1.2.c
new file mode 100644
index 0000000..9614161
--- /dev/null
+++ b/1.2.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#define LOWER 0
+#define UPPER 300
+#define STEP  20
+
+int main() {
+    float fahr;
+    size_t fahrs;
+    void *fahrp;
+    fahrs = sizeof(float);
+    fahrp = malloc(fahrs);
+    fahr = 0;
+    printf("value:%f size:%d pointer: %p\n", fahr, fahrs, fahrp);
+
+    printf("%3s\t%6s\n", "F", "C");
+    for (fahr=UPPER; fahr >= LOWER; fahr -= STEP) {
+        printf("%3.0f\t%6.2f\n", fahr, 5. * (fahr - 32.) / 9.);
+    }
+    free(fahrp);
+    return 0;
+}