fork download
  1. #include <stdio.h>
  2.  
  3. void func(char const * ary) {
  4. printf("%s\n",ary);
  5. *(ary + 1) = '\0';
  6. printf("%s\n",ary);
  7. }
  8.  
  9. int main() {
  10. char ary[] = "hoge";
  11. func(ary);
  12. return 0;
  13. }
  14. /* end */
  15.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘func’:
prog.c:5:14: error: assignment of read-only location ‘*(ary + 1u)’
   *(ary + 1) = '\0';
              ^
stdout
Standard output is empty