fork download
  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4.  
  5. typedef struct ht {
  6. int numele;
  7. } hashtable;
  8.  
  9. int main()
  10. {
  11.  
  12. hashtable o = {0};
  13. hashtable oz = {0};
  14.  
  15.  
  16. char** array = malloc(1 * sizeof(*array));
  17.  
  18. o.numele = sizeof(o);
  19. oz.numele = sizeof(array);
  20.  
  21. printf("numele %d \n", o.numele);
  22. printf("numele %d \n", oz.numele);
  23.  
  24. if (array)
  25. {
  26. array[0] = "This";
  27.  
  28. printf("%s\n------\n", array[0]);
  29.  
  30. char** tmp = realloc(array, 10 * sizeof(*array));
  31. if (tmp)
  32. {
  33. array = tmp;
  34. array[1] = "That";
  35. array[2] = "Thats";
  36.  
  37. printf("%s\n", array[0]);
  38. printf("%s\n", array[1]);
  39. printf("%s\n", array[2]);
  40. }
  41.  
  42.  
  43.  
  44. free(array);
  45. }
  46. return 0;
  47. }
  48.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
numele 4 
numele 8 
This
------
This
That
Thats