Xref: utzoo comp.std.c:2503 comp.lang.c:26274 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!helios!csseq!randy From: randy@csseq.tamu.edu (Randy Hutson) Newsgroups: comp.std.c,comp.lang.c Subject: Re: const and struct pointers Message-ID: <4325@helios.TAMU.EDU> Date: 24 Feb 90 12:36:00 GMT References: <1214@watserv1.waterloo.edu> <90054.232325CMH117@psuvm.psu.edu> Sender: usenet@helios.TAMU.EDU Reply-To: randy@csseq.tamu.edu (Randy Hutson) Followup-To: comp.std.c Distribution: all Organization: Computer Science Dept., Texas A&M University Lines: 15 In message <90054.232325CMH117@psuvm.psu.edu> CMH117@psuvm.psu.edu (Charles Hannum) writes: >The double is passed by value; so dereferencing it works fine. But the >struct is passed by reference (as are *all* structures in C!). In reality, >you need to pass a "struct qwert *" to the function. Normally, the compiler >takes the reference automatically, but you are trying to do this in reverse. >Thus, it does not work; you simply can't pass a structure by value. The original poster said his compiler claimed to be ANSI compliant. ANSI C allows structures to be assigned, returned by functions, and passed by value to functions. However, some non-ANSI compilers may do as you have said with struct function arguments.