fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. char *substring(char *str, char *buf, int start, int end) {
  5. for (int i = start; i < end; i++) buf[i] = str[i];
  6. return buf;
  7. }
  8.  
  9. int main() {
  10. char *texto = malloc(6);
  11. if (strncmp(substring("Hello World", texto, 0, 5), "Hello", 5) == 0) printf("yep");
  12. free(texto);
  13. }
  14.  
  15. //https://pt.stackoverflow.com/q/128614/101
Success #stdin #stdout 0s 4400KB
stdin
Standard input is empty
stdout
yep