~nhanb/modernc

63fd0f72557e1e5bfbefd88314b69fc39597daf8 — Nhân 1 year, 4 months ago
getting-started.c
4 files changed, 24 insertions(+), 0 deletions(-)

A .gitignore
A Makefile
A README.md
A getting-started.c
A  => .gitignore +1 -0
@@ 1,1 @@
/getting-started

A  => Makefile +2 -0
@@ 1,2 @@
getting-started: getting-started.c
	c99 -Wall -o getting-started getting-started.c -lm

A  => README.md +1 -0
@@ 1,1 @@
https://gustedt.gitlabpages.inria.fr/modern-c/

A  => getting-started.c +20 -0
@@ 1,20 @@
#include <stdlib.h>
#include <stdio.h>

int main(void) {
    double A[5] = {
        [0] = 9.0,
        [1] = 2.9,
        [4] = 3.E+25,
        [3] = .0007,
    };

    for (size_t i = 0; i < 5; ++i) {
        printf("element %zu is %g, \tits square is %g\n",
                i,
                A[i],
                A[i]*A[i]);
    }

    return EXIT_SUCCESS;
}