Talk:Struct (C programming language): Difference between revisions

Content deleted Content added
Line 49:
:In what situation would a non-programmer would need to know what a C struct is? There's no doubt a summary at the top could help though. [[User:Kupiakos|Kupiakos]] ([[User talk:Kupiakos|talk]]) 20:48, 5 July 2013 (UTC)
::As a Java and Python programmer who has never worked with C, I find this article difficult to understand. I think the biggest reason is that the explanation is almost entirely in code (which is difficult to understand if you aren't familiar with C syntax), and it lacks a high level description of what a struct is for and more importantly ''why'' anybody would want to use one. I think it would also be helpful to draw parallels between it and similar concepts in other languages. I get the impression that this is maybe like Java's Enum type, but the article doesn't say what languages use structs, aside from C, and what equivalencies, if any, exist in other languages. -[[User:Thunderforge|Thunderforge]] ([[User talk:Thunderforge|talk]]) 20:05, 14 October 2013 (UTC)
 
== Incorrect statement ==
 
The following statement in the article is incorrect:
 
"The memory is already given and zeroed by just declaring a variable of that type regardless of member initialization"
 
Asigning to a new struct by value from another struct will create a copy with the same layout, but if the rvalue is only partially initialized, the lvalue will also be partially initialized. None of the uninitialized fields will be magically "zeroed". The exception to this is structs with static storage duration -- but in the example, the structs have ''automatic'' storage duration.