Advertisement
tdulik

Krizovky

Feb 11th, 2017
1,709
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.72 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. #define VELIKOST 8000000
  6.  
  7. // const int VELIKOST 100000;
  8.  
  9. int main(int argc, char** argv) {
  10.     static char* pole[VELIKOST]; // static umožní větší velikost, je uložený v paměti globálních proměnných
  11.  
  12.     char buffer[256];
  13.     int i = 0;
  14.     while(scanf("%255s", buffer)!=EOF && i < VELIKOST) {
  15.         int delka = strlen(buffer);
  16.         if(delka > 1) {
  17.             char* novy = malloc(delka+1);
  18.             strcpy(novy, buffer);
  19.             pole[i++] = novy;
  20.         }
  21.         if ( (i & (4*65536-1)) == 0)
  22.             printf("Precten %d. radek\n", i);
  23.     }
  24.  
  25.     int N = i;
  26.     for(i = 0; i < N; i++)
  27.         puts(pole[i]);
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement