fork download
  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <cstring>
  4. typedef unsigned char byte;
  5.  
  6. int main() {
  7. char* h = "Hello World";
  8. int length = strlen(h);
  9.  
  10. byte* data = (byte*) malloc(length+1);
  11. data[length] = 0;
  12.  
  13. memcpy(data, h, length);
  14.  
  15. printf("%s", data);
  16. free(data);
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
Hello World