diff options
author | aabacchus <ben@bvnf.space> | 2021-05-19 00:11:26 +0100 |
---|---|---|
committer | aabacchus <ben@bvnf.space> | 2021-05-19 00:11:26 +0100 |
commit | 3a14f3cf7a1bd094ae73a4d2ca151464a9eda224 (patch) | |
tree | 21ca13dd11b0ea7f79feb110b954050b1656bf7a /1.2.c | |
download | kandr-3a14f3cf7a1bd094ae73a4d2ca151464a9eda224.tar.gz |
might as well make commits out of these
Diffstat (limited to '1.2.c')
-rw-r--r-- | 1.2.c | 23 |
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; +} |