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

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.