fork(3) download
  1. #include<stdio.h>
  2. int main(void){
  3. char *a[]={"error 1\n",
  4. "error 2\n",
  5. "error 3\n",
  6. "error 4\n"};
  7.  
  8. //*(*(a+1)+3)='y'; //will result into error, reason is given in the explanation
  9. printf("%c\n",*(*(a+1)+3));
  10. *(a+1)="error 9\n";
  11. printf("%s\n",*(a+1));
  12.  
  13. char b[4][10]={"error 1\n",
  14. "error 2\n",
  15. "error 3\n",
  16. "error 4\n"};
  17.  
  18. *(*(b+1)+3)='y';
  19. //b[1][3]='y';
  20. printf("%c\n",*(*(b+1)+3));
  21.  
  22. char **c={"error 1\n",
  23. "error 2\n",
  24. "error 3\n",
  25. "error 4\n"};
  26.  
  27. *(*(c+1)+3)='y';
  28. printf("%c\n",*(*(c+1)+3));
  29. return(0);
  30. }
  31.  
Success #stdin #stdout 0s 2008KB
stdin
Standard input is empty
stdout
o
error 9

y
y