Article View: csu.cs
Article #67Re: I hate c
From: eric smith
Date: Mon, 01 May 2000 00:00
Date: Mon, 01 May 2000 00:00
37 lines
1526 bytes
1526 bytes
Only one copy is allowed per thread
Adam Carheden (carheden@holly.ColoState.EDU) wrote:
: I have a c question, which, like most c questions, probably lies in the
: misunderstanding of pointers:
: I declare the following:
: struct servent *udp_service;
: struct servent *tcp_service;
: Later, I call getservicebyname to fill them:
: udp_service = getservbyname("cs457", "udp");
: tcp_service = getservbyname("cs457", "tcp");
: Next, I print the results:
: printf("UDP Protocol = %s\nTCP Protocol = %s\n", udp_service->s_proto,
: tcp_service->s_proto);
: This produces the following output:
: UDP Protocol = tcp
: TCP Protocol = tcp
: If I reverse the order of the getservbyname lines, I get the opposite:
: UDP Protocol = udp
: TCP Protocol = udp
: Both structures always point to the same thing. Why?
: --
: Adam Carheden
: carheden@holly.ColoState.EDU
Technical Details
Message-ID:
<8ek0es$lml@handel.cs.colostate.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<39024CF4.C4286D1D@holly.ColoState.EDU>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 148df6,cb61e576f2f3a144 X-Google-Attributes: gid148df6,public X-Google-Thread: 11c4c0,cb61e576f2f3a144 X-Google-Attributes: gid11c4c0,public From: smithe@handel.cs.colostate.edu (eric smith) Subject: Re: I hate c Date: 2000/05/01 Message-ID: <8ek0es$lml@handel.cs.colostate.edu> X-Deja-AN: 617841606 References: <39024CF4.C4286D1D@holly.ColoState.EDU> Followup-To: csu.cs,csu.cs.c++ X-Trace: 1 May 2000 07:22:37 -0700, handel.cs.colostate.edu Organization: Computer Science Department, Colorado State University Newsgroups: csu.cs,csu.cs.c++