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.  
  14. char** array = malloc(1 * sizeof(*array));
  15.  
  16. o.numele = sizeof(o);
  17.  
  18. printf("numele %d \n", o.numele);
  19. if (array)
  20. {
  21. array[0] = "This";
  22.  
  23. printf("%s\n------\n", array[0]);
  24.  
  25. char** tmp = realloc(array, 10 * sizeof(*array));
  26. if (tmp)
  27. {
  28. array = tmp;
  29. array[1] = "That";
  30. array[2] = "Thats";
  31.  
  32. printf("%s\n", array[0]);
  33. printf("%s\n", array[1]);
  34. printf("%s\n", array[2]);
  35. }
  36.  
  37.  
  38.  
  39. free(array);
  40. }
  41. return 0;
  42. }
  43.  
Success #stdin #stdout 0s 5256KB
stdin
Standard input is empty
stdout
numele 4 
This
------
This
That
Thats