dcsimg
Main » TERM » S »

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.










LATEST ARTICLES
Texting & 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... Read More »

Huge List of Computer Certifications

Have you heard about a computer certification program but can't figure out if it's right for you? Use this handy list to help you decide. Read More »

STUDY GUIDES
Computer Architecture Study Guide

Computer architecture provides an introduction to system design basics for most computer science students. Read More »

Network Fundamentals Study Guide

Networking fundamentals teaches the building blocks of modern network design. Learn different types of networks, concepts, architecture and... Read More »

The Five Generations of Computers

Learn about each of the five generations of computers and major technology developments that have led to the computing devices that we use... Read More »