answersLogoWhite

0

What is a structure in c programing?

Updated: 10/24/2022
User Avatar

Wiki User

13y ago

Best Answer

A rectangle might have a width, a height, a color, and a fill

pattern. C lets us organize these four items into one group called a

structure. Example

struct rectangle {

int width; /* Width of rectangle in pixels */

int height; /* Height of rectangle in pixels */

color_type color; /* Color of the rectangle */

fill_type fill; /* Fill pattern */

}; Another example suppose we want to record

the time a runner completes each lap of a four -lap race. We define a structure to

store the time:

struct time {

int hour; /* hour (24 hour clock ) */

int minute; /* 0-59 */

int second; /* 0-59 */

}; A rectangle might have a width, a height, a color, and a fill

pattern. C lets us organize these four items into one group called a

structure. Example

struct rectangle {

int width; /* Width of rectangle in pixels */

int height; /* Height of rectangle in pixels */

color_type color; /* Color of the rectangle */

fill_type fill; /* Fill pattern */

}; Another example suppose we want to record

the time a runner completes each lap of a four -lap race. We define a structure to

store the time:

struct time {

int hour; /* hour (24 hour clock ) */

int minute; /* 0-59 */

int second; /* 0-59 */

};

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

It is basicly (This is a verry basic explaination)...

You can create your own types! Which Each Hold Other types !?

Such as

#include stuff and this and that.

struct Cat

{

int How_Many_Whiskers;

bool Is_Dead;

bool Is_Hungry;

}Sooty; //Sooty is now a member (?) Of Cat!

int main

{

Sooty.How_Many_Whiskers = 10;//Cat has 10 Whiskers.

Cat Snowdrop;//Snowdrop is a member (?) of Cat

Snowdrop.How_Many_Whiskers = 11;

cout<<"Snowdrop.Is_Dead";//This is how you cout structs

}

//you can do structs inside structs to!

//It would be something like for example

//Cat Cat_Type Sooty;

//

Sorry If I dont make that much sense :) Just Google struct or structures of you are confused. They are good for inventorys, such as the rpg game I am making:

eg:

struct Inventory

{

int Number;

int Sell;

int Buy;

int Damage;

int Health;

int Variation;

int Defence;

char Icon;

int Charge;

bool Quest_Item;

};

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is a structure in c programing?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Short note on structural programming and procedural programming?

There is no difference between procedural programing language &amp; structure programing language.


What are the examples of programing language?

c, c++, java, prolog, fortran, basic, ...


Is c an object oriented programing language?

C language is not a program, and it isn't an object-oriented language either.


Why PERL is preferred over C in modern day bioinformatics algorithm development?

due to is data structure and string matching perl had captured bioinformatics tool developmantanother reason may be due to various module like bioperl etc it is not letting other lang of programing to get into this field


What is structured programming in java?

It is a subset of procedural programing that enforces a logical structure on the program being written to make it more efficient and easier to understand and modify.

Related questions

Is c programing a procedure oriented programing?

yes


Why you need C programming?

C- Programing is basically a programing language of a computer. It helps to create software programing language which is usefull in creating softwares &amp; data base programes. C programing language is the first &amp; basic programing language. Other programing languages are:- C, C++ &amp; C# (latest).


What do you mean by c?

c is a programing language


Short note on structural programming and procedural programming?

There is no difference between procedural programing language &amp; structure programing language.


What is statement in C programing?

One of the statements, obviously.


What are the examples of programing language?

c, c++, java, prolog, fortran, basic, ...


How do you perform programs on c programing language?

Using IDE environment


What are some examples of programming language?

The most well-known programming languages are C, C++, C#, CSS, HTML, Javascript, PHP, Pascal/Delphi, Prolog, Python, Ruby, Visual Basic, and Visual Basic .NET, java.


Is c an object oriented programing language?

C language is not a program, and it isn't an object-oriented language either.


Why c language is called c language?

C is descendent from another programing language called B which was at that time when 'C' was invented. That's why it derived its name as 'C' successive to 'B'.


What are programming language that produced c?

C is a programming language. Example of C or C++ Programing would be the following: add matrices, get ip address, and read files.


List some programing languages?

* Java * C, C++ * Basic * COBOL * Fortran * Pascal * .Net * Visual Basic * etc...