structured type in C programming language
In the C programming language, struct (referring to a structure) is the keyword used to define a composite, a.k.a. record, data type – a named set of values that occupy a block … Wikipedia
🌐
Wikipedia
en.wikipedia.org › wiki › Struct_(C_programming_language)
struct (C programming language) - Wikipedia
February 8, 2026 - In the C programming language, struct (referring to a structure) is the keyword used to define a composite, a.k.a. record, data type – a named set of values that occupy a block of memory. It allows for the different values to be accessed via a single identifier, often a pointer.
🌐
W3Schools
w3schools.com › c › c_structs.php
C Structures (structs)
C Examples C Real-Life Examples C Exercises C Quiz C Code Challenges C Practice Problems C Compiler C Syllabus C Study Plan C Interview Q&A ... Structures (also called structs) are a way to group several related variables into one place.
🌐
GeeksforGeeks
geeksforgeeks.org › c language › structures-c
C Structures - GeeksforGeeks
The typedef keyword is used to define an alias for the already existing datatype. In structures, we have to use the struct keyword along with the structure name to define the variables. Sometimes, this increases the length and complexity of the code.
Published   3 weeks ago
🌐
Programiz
programiz.com › c-programming › c-structures
C struct (Structures)
In this tutorial, you'll learn about struct types in C Programming. You will learn to define and use structures with the help of examples. In C programming, a struct (or structure) is a collection of variables (can be of different types) under a single name.
🌐
Learn C
learn-c.org › en › Structures
Structures - Learn C - Free Interactive C Tutorial
C structures are special, large variables which contain several named variables inside. Structures are the basic foundation for objects and classes in C.
🌐
Medium
medium.com › @adithyaravichandran11 › the-ultimate-guide-to-structs-in-c-from-beginner-to-pro-b62157d21c73
The Ultimate Guide to Structs in C: From Beginner to Pro | by Adithyaravichandran | Medium
May 20, 2025 - If you’re diving into C programming, you’ll soon discover that structs (short for structures) are one of the most powerful tools in your toolkit. They let you bundle related data into a single unit, making your code cleaner and more organized. Whether you’re a complete beginner or a seasoned coder looking to master advanced techniques, this guide is your one-stop resource for understanding structs in C.
🌐
TutorialsPoint
tutorialspoint.com › cprogramming › c_structures.htm
Structures in C
A structure in C is a derived or user-defined data type. We use the keyword struct to define a custom data type that groups together the elements of different types. The difference between an array and a structure is that an array is a homogenous
Find elsewhere
🌐
GNU
gnu.org › software › c-intro-and-ref › manual › html_node › Structures.html
Structures (GNU C Language Manual)
Next: Arrays, Previous: Pointers, Up: GNU C Manual [Contents][Index] A structure is a user-defined data type that holds various fields of data. Each field has a name and a data type specified in the structure’s definition. Because a structure combines various fields, each of its own type, ...
🌐
Swarthmore College
cs.swarthmore.edu › ~newhall › cs31 › resources › C-structs_pointers.php
CS31: Intro to C Structs and Pointers
A struct is a type used to represent a heterogeneous collection of data; it is a mechanism for treating a set of different types as a single, coherent unit. For example, a student may have a name, age, gpa, and graduation year.
🌐
Yale University
cs.yale.edu › homes › aspnes › pinewiki › C(2f)Structs.html
C/Structs
Variables of type struct can be assigned to, passed into functions, returned from functions, and tested for equality, just like any other type.
🌐
cppreference.com
en.cppreference.com › c › language › struct
Struct declaration - cppreference.com
A struct is a type consisting of a sequence of members whose storage is allocated in an ordered sequence (as opposed to union, which is a type consisting of a sequence of members whose storage overlaps).
🌐
Beej
beej.us › guide › bgc › html › split › structs.html
Beej's Guide to C Programming
If you’ve come from another language, you might be familiar with the idea of classes and objects. These don’t exist in C, natively69. You can think of a struct as a class with only data members, and no methods.
🌐
Educative
educative.io › answers › what-is-a-c-struct
What is a C struct?
C struct, short for C Structure, is an user-defined data type available in C.
🌐
Programiz
programiz.com › c-programming › c-structure-function
C Struct and Functions
In this tutorial, you'll learn to pass struct variables an argument to a function in C programing. You will learn to return struct from a function with the help of examples.
🌐
Scaler
scaler.com › home › topics › structures in c
Structures in C - Scaler Topics
April 9, 2024 - Then the body of the structure is defined, in which the required data members (primitive or user-defined data types) are added. ... In the above syntax, the data_members can be of any data type like int, char, double, array or even any other user-defined data type.
🌐
Simplilearn
simplilearn.com › home › resources › software development › c structure explained: syntax and uses in programming
C Structure Explained: Syntax and Uses in Programming
June 9, 2025 - Understand structure in C programming with detailed syntax and examples. Explore how C structures simplify data organization and improve program efficiency.
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
Medium
medium.com › @hatronix › mastering-structs-in-c-an-in-depth-guide-4a524af06fd4
Mastering Structs in C: An In-Depth Guide | by Hari Perev | Medium
October 30, 2023 - A struct in C is a composite data type that lets you bundle together variables of different data types. This grouping allows you to organize and manipulate related data more easily.
Top answer
1 of 4
37

Well, the obvious difference is demonstrated in your main:

struct foo a;
bar b;
baz c;

The first declaration is of an un-typedefed struct and needs the struct keyword to use. The second is of a typedefed anonymous struct, and so we use the typedef name. The third combines both the first and the second: your example uses baz (which is conveniently short) but could just as easily use struct _baz to the same effect.

Update: larsmans' answer mentions a more common case where you have to use at least struct x { } to make a linked list. The second case wouldn't be possible here (unless you abandon sanity and use a void * instead) because the struct is anonymous, and the typedef doesn't happen until the struct is defined, giving you no way to make a (type-safe) pointer to the struct type itself. The first version works fine for this use, but the third is generally preferred in my experience. Give him some rep for that.

A more subtle difference is in namespace placement. In C, struct tags are placed in a separate namespace from other names, but typedef names aren't. So the following is legal:

struct test {
  // contents
};

struct test *test() {
  // contents
}

But the following is not, because it would be ambiguous what the name test is:

typedef struct {
  // contents
} test;

test *test() {
  // contents
}

typedef makes the name shorter (always a plus), but it puts it in the same namespace as your variables and functions. Usually this isn't an issue, but it is a subtle difference beyond the simple shortening.

2 of 4
33

It's largely a matter of personal preference. I like to give new types a name starting with a capital letter and omit the struct, so I usually write typedef struct { ... } Foo. That means I cannot then write struct Foo.

The exception is when a struct contains a pointer to its own type, e.g.

typedef struct Node {
    // ...
    struct Node *next;
} Node;

In this case you need to also declare the struct Node type, since the typedef is not in scope within the struct definition. Note that both names may be the same (I'm not sure where the underscore convention originated, but I guess older C compilers couldn't handle typedef struct X X;).

🌐
WsCube Tech
wscubetech.com › resources › c-programming › structures
Structures in C Programming (C struct With Examples)
March 18, 2026 - Learn in this tutorial about structures (struct) in C with simple examples. Understand its syntax, variable declaration, initialization, and usage in C programs.