I am accepting the path through command line input.
When I do
dir=opendir(args[1]);
it doesn\' t enter the loop...i.e dir==nu
Parameters passed to the C program executable is nothing but an array of string(or character pointer),so memory would have been already allocated for these input parameter before your program access these parameters,so no need to allocate buffer,and that way you can avoid error handling code in your program as well(Reduce chances of segfault :)).