I'm sick of this warning! Here's the code
struct passwd *pwd; code In function printLine: gid_t gid = statbuf.st_gid; pwd = getgrgid(gid); if(pwd != NULL) printf("%s]", pwd->pw_name); else 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); ^
: Edited by User
Whats the return type of getgrgid?
struct group *
pwd seems to be of type struct passwd * but getgrgid() returns struct group * The first three elements of the two structs are similar, thus the code still works.
Yalu X. wrote: > pwd seems to be of type > > struct passwd * > > but getgrgid() returns > > struct group * > > The first three elements of the two structs are similar, thus the code > still works. Thanks