Struct Definition & Meaning

A struct, or structure, in C programming languages is a container that holds variables of different data types that can be accessed together. Structs are helpful because they can categorize and group related data. Structs occur in C programming languages, which include C# and C++.

To initiate and use a struct, first declare the struct and place an optional title (or tag) before it:

struct Title { } ;

Then place a semicolon at the end of the struct.

Structs contain variables, which identify the specific piece of data with which they’re paired within the struct. Some common variables in C programming include int, char, and float, which indicate the data type they store. For example, if one struct holds data about one particular customer in a business, the variable char might relate to the customer’s name, while int (integer) contains their specific customer ID number. The specific information that a variable stores is known as a value. Structs provide a method of grouping related (or perhaps unrelated) data in an organized format.

To access data in a struct, use a member operator (often a period) between the variable and the specific data member. You can also use a pointer to locate data stored in a struct. Pointers use the memory address of a variable, which has been programmed within the struct, to locate that variable’s corresponding data.






Jenna Phipps
Jenna Phipps
Jenna Phipps is a contributor for websites such as Webopedia.com and Enterprise Storage Forum. She writes about information technology security, networking, and data storage. Jenna lives in Nashville, TN.

Top Articles

Huge List Of Texting and Online Chat Abbreviations

From A3 to ZZZ we list 1,559 text message and online chat abbreviations to help you translate and understand today's texting lingo. Includes Top...

How To Create A Desktop Shortcut To A Website

This Webopedia guide will show you how to create a desktop shortcut to a website using Firefox, Chrome or Internet Explorer (IE). Creating a desktop...

The History Of Windows Operating Systems

Microsoft Windows is a family of operating systems. We look at the history of Microsoft's Windows operating systems (Windows OS) from 1985 to present...

Hotmail [Outlook] Email Accounts

  By Vangie Beal Hotmail is one of the first public webmail services that can be accessed from any web browser. Prior to Hotmail and its...

Abacus Definition & Meaning

An abacus, also known as a counting frame, is a mechanical device used...

Legacy Code Definition &...

Legacy code refers to source code that has been inherited from a previous...

Unregulated Power Supply Definition...

An unregulated power supply is a system that transforms input voltage into direct...