Computer Programming
C Programming
C++ Programming

Structure in c?

012

Answer

User Avatar
Wiki User
09/10/2010

A structure (from now on called struct), is a list of several ODT (old data types).

I can have a structure that keeps track of, let's say my user info:

struct User {

char Username[256];

int TimeOn;

};

Note the semicolon.

Now, you can access structs by declaring a variable of struct User.

struct User UserOne;

UserOne.Username = "Bob";

UserOne.TimeOne = 0;