types/array-intro-1.c - Introduktion af arrays. | Lektion 9 - slide 2 : 30 Program 2 |
#include <stdio.h> #define TABLE_SIZE 11 int main(void) { /* Declaration: */ double table[TABLE_SIZE]; int i; /* Initialization: */ for(i = 0; i < TABLE_SIZE; i++) table[i] = (double)(2 * i); /* Access - printing: */ for(i = 0; i < TABLE_SIZE; i++) printf("%f\n", table[i]); printf("\n"); return 0; }