Thanks all. It was a eye opener.
Type: Posts; User: ramchan
Thanks all. It was a eye opener.
As far as I understand, its not mandatory to allocate memory as pointed by second snippet. ( Sorry for including line numbers )
However, the below code still works, though "s" has not allocated memory.
1 #include<stdio.h>
2 #include<stdlib.h>
3 #include<sys/types.h>
4 #include <sys/stat.h>
5
I m trying to execute the below snippet but ending in Seg fault.
gdb points to line 16 in "while" loop. If I comment out the "stat" at line 12, code runs fine. Does "stat" locks the file that I m...