const and struct pointers
Randy Hutson
randy at csseq.tamu.edu
Sat Feb 24 23:36:00 AEST 1990
In message <90054.232325CMH117 at psuvm.psu.edu> CMH117 at 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.
More information about the Comp.lang.c
mailing list