warning: assignment from incompatible pointer type

OP (Company: no) #5067690
Rate this post
useful
not useful
I'm sick of this warning! Here's the code
1
struct passwd *pwd; 
2

3
code In function printLine:
4
gid_t gid = statbuf.st_gid;
5
        pwd = getgrgid(gid);
6
        if(pwd != NULL)
7
            printf("%s]", pwd->pw_name);
8
        else
9
            printf("%d]", statbuf.st_gid);
All prints correctly when executed. What needs to be corrected so that 
the selection disappears?
====
ls.c: In function ‘printLine’:
ls.c:225:13: warning: assignment from incompatible pointer type
         pwd = getgrgid(gid);
             ^

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now