Advertisement
Guest User

Untitled

a guest
Mar 14th, 2021
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <stdlib.h>
  2. #include <math.h>
  3. #include "kvec.h"
  4.  
  5. int main(){
  6.  
  7. // Declare the sizes:
  8. int N, len, j, k ;
  9. N = 1000 ;
  10. len = 10000 ;
  11.  
  12. // Declare the vector of arrays:
  13. kvec_t(int*) vec ;
  14. kv_init(vec) ;
  15.  
  16. // Populate each of them:
  17. for(j=0; j<N; ++j){
  18. int* newar = malloc(len*sizeof(int));
  19. for(k=0; k<N; ++k){
  20. newar[k] = k ;
  21. }
  22. kv_push(int*, vec, newar) ;
  23. }
  24.  
  25. // free:
  26. for(j=0; j<N; ++j){
  27. free(kv_A(vec, j)) ;
  28. }
  29.  
  30. kv_destroy(vec) ;
  31.  
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement