compilation error

Posted by Bond on Stack Overflow See other posts from Stack Overflow or by Bond
Published on 2010-12-26T10:03:41Z Indexed on 2010/12/26 11:53 UTC
Read the original article Hit count: 137

Filed under:
#include<dirent.h>
#include<stdio.h>
#include<stdlib.h>
#include<sys/stat.h>
int main ()
{
struct dirent **namelist;
int i,j;
char userd[20];
struct stat statBuf;
printf("Enter a directory %s\n",userd);
scanf("%s",&userd);
printf("the dir is %s\n",*userd);
        i=scandir(".",&namelist,0,alphasort);
        printf("enter a directory name %s",*userd);
        printf("scandir returned i=%d\n",&i);

if (i<0)
perror("Scandir failed to open directory I hope you understand \n");
else
 {
        for(j=0;j<i;j++)
        {
          printf("j=%d i=%d %s\n",j,i,namelist[j]->d_name);
         // lstat
          free(namelist[j]);
        }
 }
free(namelist);
}

Can some one help to understand why am I getting warning in above code?

© Stack Overflow or respective owner

Related posts about c