Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!paul From: paul@cs.utexas.edu (Supoj Sutanthavibul) Newsgroups: comp.lang.c Subject: structure constant assignment Message-ID: <6990@cs.utexas.edu> Date: 5 Oct 89 10:08:27 GMT Distribution: usa Organization: U. Texas CS Dept., Austin, Texas Lines: 28 We can always assign one structure variable to another of the same type (at least on the SUN). We can also assign value to individual members of a structure but it is so cumbersome especially in for large structures. Initialization of structure variables is allowed. However assignment of constant to a structure variable in single assignment expression is not allowed (since C syntax does nota allow construction of structure constants) Why? Does standard C allow assignment of structure constant as in the following example? I know that one can write functions to construct structure constant but I think that is an overkill. typedef struct coord { int x, y; } Coord; main() { Coord p, q; q = (Coord){ 0, 0 }; <--- this is not allowed p = q; <--- this is allowed. }