About 50 results
Open links in new tab
  1. c - typedef struct vs struct definitions - Stack Overflow

    I'm a beginner in C programming, but I was wondering what's the difference between using typedef when defining a structure versus not using typedef. It seems to me like there's really …

  2. How to use a struct in C? - Stack Overflow

    Aug 6, 2009 · 10 C requires that you reference structs with a "struct" prefix, so it's common to introduce a typedef for less verbose mention. That is, the declaration of your struct has two …

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

  4. malloc for struct and pointer in C - Stack Overflow

    Additionally, your type should be struct Vector *y since it's a pointer, and you should never cast the return value from malloc in C. It can hide certain problems you don't want hidden, and C is …

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

    Sep 12, 2015 · bar b; baz c; 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 …

  6. struct - C-like structures in Python - Stack Overflow

    Aug 30, 2008 · The following solution to a struct is inspired by the namedtuple implementation and some of the previous answers. However, unlike the namedtuple it is mutable, in it's …

  7. How to initialize a struct in accordance with C programming …

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

  8. c - How to create a new instance of a struct - Stack Overflow

    Note that for p1 the order of properties matches that of the struct definition. If you don't want to type struct all the time when you use a type you can define a new alias using

  9. When should you use a class vs a struct in C++? [duplicate]

    The differences between a class and a struct in C++ are: struct members and base classes/structs are public by default. class members and base classes/structs are private by …

  10. c - Difference between -> and . in a struct? - Stack Overflow

    Difference between -> and . in a struct? Asked 14 years, 7 months ago Modified 1 year, 7 months ago Viewed 73k times