getgroups

#include < sys/types.h >
#include < unistd.h >

#include < limits.h >
#include < stdio.h >

int main()
{
    int i;
    int groups;
    gid_t list[NGROUPS_MAX];
    
    if((groups = getgroups(NGROUPS_MAX, list))< 0){
        perror("getgroups");
        return 1;
    }
    
    for (i = 0; i < groups; i++){
        printf("%d", (int)list[i]);
    }
    putchar('\n');
    return 0;
}