fork download
  1. #include <stdio.h>
  2. #include <assert.h>
  3.  
  4. int mystrlen(char *s)
  5. {
  6. int i = 0;
  7. assert(s[0] !='\0');
  8.  
  9. for(i = 0; s[i] !='\0'; i++)
  10. // Placing {} here causes the error to disappear //
  11. return i;
  12. }
  13.  
  14. int main(void)
  15. {
  16. char hello[] = "hello";
  17. int len = mystrlen(hello);
  18. printf("Length = %d\n", len);
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 2248KB
stdin
Standard input is empty
stdout
Length = 0