APPFS
Advanced practical programming for scientists
|
Appfs Exercise 1: stream input. More...
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <assert.h>
Go to the source code of this file.
Macros | |
#define | MAX_NUMS ((INT_MAX >> 5) + 1) |
Maximum number of 32 bit ints we need to store bits. More... | |
Functions | |
int | main (int argc, char **argv) |
Program to read a file with binary positive 32 bit integers, sort the numbers and print them sorted. More... | |
gcc -O3 -Wall -std=c99 -o ex1b ex1b.c
Use stream file for input
Definition in file ex1b.c.
int main | ( | int | argc, |
char ** | argv | ||
) |
Actually, the numbers are not sorted. There is an array with one bit for each possible number. Upon reading the respective bit is set for the number recognized. At the end the array is scanned in order and the numbers present are printed.
argv | [1] name of file to read |
Definition at line 26 of file ex1b.c.