fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdbool.h>
  4.  
  5. bool test(char** myCharArray)
  6. {
  7. char *response = malloc(2);
  8. response[0] = 'A';
  9. response[1] = 'B';
  10.  
  11. *myCharArray = response;
  12. return true;
  13. }
  14.  
  15. int main()
  16. {
  17. char* testArray;
  18.  
  19. test(&testArray);
  20.  
  21. char c1 = testArray[0];
  22. char c2 = testArray[1];
  23.  
  24. // c1 is not equal to 'A'
  25. // c2 is not equal to 'B'
  26. printf("%c %c\n", c1, c2);
  27. }
Success #stdin #stdout 0s 4164KB
stdin
Standard input is empty
stdout
A B