All pastes #10911 Raw Edit

Top ten words

public c v1 · immutable
#10911 ·published 2005-05-04 16:59 UTC
rendered paste body
#include <stdio.h>#include <string.h>int main(int argc, char **argv){struct element{   int counter;   char word[256];   struct element *next;}struct element *firstel;char word[256];	if ( argc != 2 ) {		printf("Lahko podate samo en argument.\n");		exit (1);	}	if ( (file = fopen(argv[1], "r")) == NULL) {		printf("Napaka pri branju datoteke, ali datoteka ne obstaja.\n");		exit (1);	}	/*begin actual code*/	/*(prebere iz fajla besedo in jo shrni v *word)*/		readWord(word);		/*end actual code*/}void readWord(char* rword){	if(checkWord(rword)){		struct element *new;		new = (struct element*) malloc(sizeof(struct element));		new.word=rword;		new.counter=1;		new->next = firstel;		firstel = new;	}else{	/*poveca stevec za ena*/	}}int checkWord(){/*preveri ce je beseda ze v bazi*/}void printTop(){/*izpise prvih 10*/}