uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

arrays_ex1.c (364B)


      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 #include <time.h>
      4 
      5 /* Make an array of 10 ints and assign random values in it */
      6 
      7 int
      8 main(int argc, char *argv[])
      9 {
     10         int arr[10], i = 0;
     11 
     12         srand(time(NULL));
     13         for (; i < 10; i++) {
     14                 arr[i] = rand() % 101;
     15                 printf("arr[%d]: %d\n", i, arr[i]);
     16         }
     17 
     18         return 0;
     19 }