Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 19th, 2012  |  syntax: None  |  size: 0.61 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. void sortare(){
  6.  
  7. }
  8.  
  9.  
  10.  
  11.  
  12. int main () {
  13.  
  14.   char *lista[1000];
  15.   for( int i = 0 ; i < 500 ; i++)
  16.     lista[i] =(char *) malloc(sizeof(char));
  17.  
  18.   int i;
  19.   int lungime;
  20.   FILE *f;
  21.   FILE *g;
  22.   f = fopen ("nume.in","r");
  23.   g = fopen ("nume_sortate.in","w");
  24.  
  25.   i = 0 ;
  26.   while(!feof(f)){
  27.     printf("Am intrat cu i = %d\n", i);
  28.     fscanf(f,"%s", &lista[i]);
  29.     i++;
  30.   }
  31.  
  32.   lungime = i;
  33.  
  34.   for ( i = 0 ; i < lungime-1 ; i++ )
  35.     for( int j = 0 ; j <= strlen(lista[i]); j++)
  36.         printf("%s\n", lista[i][j]);
  37.  
  38.   return 0;
  39.   }