About 10,800,000 results
Open links in new tab
  1. c - Difference between -> and . in a struct? - Stack Overflow

    If I have a struct like struct account { int account_number; }; Then what's the difference between doing myAccount.account_number; and myAccount->account_number; or isn't there a …

  2. c - typedef struct vs struct definitions - Stack Overflow

    225 struct and typedef are two very different things. The struct keyword is used to define, or to refer to, a structure type. For example, this:

  3. What's the syntactically proper way to declare a C struct?

    Sep 12, 2015 · The first declaration is of an un- typedef ed struct and needs the struct keyword to use. The second is of a typedef ed anonymous struct, and so we use the typedef name.

  4. Return a `struct` from a function in C - Stack Overflow

    But a struct is a properly first-class type, and can be assigned, passed, and returned with impunity. You don't have to define your own operator= (as indeed you could in C++), because …

  5. Proper way to initialize C++ structs - Stack Overflow

    Jan 21, 2017 · Our code involves a POD (Plain Old Datastructure) struct (it is a basic c++ struct that has other structs and POD variables in it that needs to get initialized in the beginning.) …

  6. c - Passing struct to function - Stack Overflow

    Apr 29, 2012 · A bit late to ask, but why typedef the struct to the same name (but with a capital)? I'm also wondering why you need to create a pointer to the struct (*cptr), then use that to pass …

  7. struct - C++ Structure Initialization - Stack Overflow

    struct address { int street_no; char *street_name; char *city; char *prov; char *postal_code; }; address temp_address = { .city = "Hamilton", .prov = "Ontario" }; The links here and here …

  8. Working with a union of structs in C - Stack Overflow

    Dec 23, 2013 · One note that may be a point of misunderstanding is that the union holds EITHER the int, or TYPEA, or TYPEB, so in particular you cannot rely on your int type; in the union to …

  9. c# - When to use record vs class vs struct - Stack Overflow

    Nov 13, 2020 · You create struct types for data structures that store data and are small enough to copy efficiently. You create record types when you want value-based equality and comparison, …

  10. What are the differences between struct and class in C++?

    The difference between struct and class keywords in C++ is that, when there is no specific specifier on particular composite data type then by default struct or union is the public …