Advertisement
Guest User

djnkasdsad

a guest
Apr 8th, 2020
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5.  
  6. int main() {
  7.     int nizStack[100] = { 1,2,3 };
  8.     int n;
  9.     printf("Unesite koliki niz zelite: ");
  10.     scanf("%d", &n);
  11.     // n = 8
  12.     int* niz = malloc(n * sizeof(int)); // odvoji prostor nista spec ne radi
  13.     int* nizC = calloc(25, sizeof(int)); // stavi im vrednosti 0
  14.     niz[1] = 12;
  15.     printf("%d", niz[1]);
  16.     free(niz);
  17.     free(nizC);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement