Saturday, September 20, 2008

C...learning: Chapter 6 of 8 "Structures"

Here we have with a master piece part!
From what I can get its usefull for creating databases forms but I'll have to ask for it
answer: yes thats an example of its usance

It was a very productive day. I believe that these will be very usefull in game programming where you will have tens of elements with properties (enemies, objects etc...)

Now set a closer look upon structures...

A structure - the way I see it of course - is an object, more like a box in which you can store elements (variables). Once created, it contains the variables (charactersitcs) of your project and you can call those separately to appear.

Doesn't it reminds an Array? If we have an Array for storing several elements, why shall we have a structure?

It gives you the ability to create databases. I've created a structure "User" which contained Name,Surname,Age and I've put 10 of this structures into a 10 size array.

So now each cell contained all 3 types a user's informations (Name,Surname,Age)

If there werent structures I would have to create 3 arrays and jumping like a Kangaroo from array to array.

So structures are like folders. You put inside them all informations about their element and you store them (all the folders) into a drawer (array) with a characterstical name on each folder to be able at any time to lift it and imediately access all of its informations-elements. I've created this image

No comments: