Advertisement
dzieciol

wskazniki zadanie 5

Dec 16th, 2015
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int n;
  7.     printf("podaj rozmiar tablicy");
  8.     scanf("%d",&n);
  9.     int *tab_int;
  10.     tab_int=(int*)malloc(n*sizeof(int));
  11.     int i;
  12.     for (i=0;i<n;i++)
  13.     {
  14.         printf("podaj element nr %d z %d do tablicy \n",i+1,n);
  15.         scanf("%d",&tab_int[i]);
  16.  
  17.     }
  18.      printf("podaj rozmiar tablicy");
  19.     scanf("%d",&n);
  20.  
  21.     tab_int=(int*) realloc(tab_int,n*sizeof(int));
  22.  
  23. if (tab_int==NULL) printf("blad");else
  24.     for (i=0;i<n;i++)
  25.     {
  26.         printf("podaj element nr %d z %d do tablicy \n",i+1,n);
  27.         scanf("%d",&tab_int[i]);
  28.  
  29.     }
  30.  
  31.  
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement