About 9,940,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 differen...

  2. 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 any struct is by …

  3. 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:

  4. 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 keywords that merely …

  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.) Based one what I...

  6. 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.

  7. c - Struct inside struct - Stack Overflow

    Dec 26, 2012 · struct FRIDGE; // This is a forward declaration, now an incomplete type struct PERSON{ int age; struct FRIDGE fridge; }; struct FRIDGE{ int number; }; struct FRIDGE fr; fr.number=1; struct …

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

    Dec 23, 2013 · typedef struct WRAPPER { union MEMBER* member; struct WRAPPER* next; } WRAPPER; Questions: (With 'w' as a pointer to an allocated WRAPPER struct) Accessing using w …

  9. How to initialize a struct in accordance with C programming language ...

    I want to initialize a struct element, split in declaration and initialization. This is what I have: typedef struct MY_TYPE { bool flag; short int value; double stuff; } MY_TYPE; void funct...

  10. How to properly use `typedef` for structs in C? - Stack Overflow

    Feb 25, 2022 · Note that structure tags are in a separate namespace from typedef names, so it is legitimate to use typedef struct tagname tagname;. The body of the structure can appear between …