Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. void main() {
  5. do_something("test\n");
  6. }
  7.  
  8. int do_something(char msg[10]) {
  9. printf("..%s..",msg);
  10. msg[strcspn ( msg, "\n" )] = '\0';
  11. printf("..%s..",msg);
  12. }
  13.  
  14. ============================
  15. $> gcc -o test test.c
  16. $> ./test
  17. ..test
  18. Segmentation fault
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement