Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
C syntax
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====Assignment==== Assigning values to individual members of structures and unions is syntactically identical to assigning values to any other object. The only difference is that the ''lvalue'' of the assignment is the name of the member, as accessed by the syntax mentioned above. A structure can also be assigned as a unit to another structure of the same type. Structures (and pointers to structures) may also be used as function parameter and return types. For example, the following statement assigns the value of 74 (the ASCII code point for the letter 't') to the member named ''x'' in the structure ''tee'', from above: <syntaxhighlight lang=C>tee.x = 74;</syntaxhighlight> And the same assignment, using ''ptr_to_tee'' in place of ''tee'', would look like: <syntaxhighlight lang=C>ptr_to_tee->x = 74;</syntaxhighlight> Assignment with members of unions is identical.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)