G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 10th, 2020 181 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /******************************************************************************
  2.  
  3.                             Online C Compiler.
  4.                 Code, Compile, Run and Debug C program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11.  
  12. int main()
  13. {
  14.    
  15.     FILE *fp;
  16.     int numero, i=0, j=0, count=0, *array;
  17.    
  18.    
  19.     array = (int *) malloc(100);
  20.  
  21.    
  22.     fp=fopen("numeri.txt", "r");
  23.     if(fp==NULL){
  24.         printf("Errore apertura file\n");
  25.         return 1;
  26.     }
  27.    
  28.     while(!feof(fp)){
  29.         fscanf(fp,"%d", &numero);
  30.         array[i++]=numero;
  31.         count++;
  32.     }
  33.    
  34.     array = (int*) realloc(array, count+20);
  35.  
  36.    
  37.     for(int i=0; i<count; i++)
  38.     printf("%d ", array[i]);
  39.    
  40.     return 0;
  41. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top