fork download
  1. #include <stdlib.h>
  2. #include <string.h>
  3. #include <stdio.h>
  4. int main() {
  5. char *h = malloc(3 * sizeof(char));
  6. h[0] = 'h';
  7. h[1] = 'e';
  8. h[2] = 'y';
  9. int len = strlen(h);
  10. printf("the string is %d characters long\n", len);
  11. free(h);
  12. return 0;
  13. }
  14.  
  15.  
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
the string is 3 characters long