Following code is printing protoent structure.
Unless I do getprotoent()
I can’t print structure variable although I initialize it.
It ends segmentation falter if I don’t getprotoent().
Does anyone know this?
Samle.c
#include <stdio.h>
#include <string.h>
#include <netdb.h>
int
main(){
struct protoent *proto;
memset(&proto,0,sizeof(proto));
proto = getprotoent();
printf("proto.p_name = %s\n",(*proto).p_name);
printf("proto.p_aliases = %s\n",*(*proto).p_aliases);
printf("proto.p_proto = %d\n",(*proto).p_proto);
}