Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/11/05 23:18
Read: times


 
#89516 - Struct
Responding to: ???'s previous message
I have not used the Struct command heavy in 8051 C. I am still kinda new to SDCCC, but in Borland C++ on the PC. then the
Struct Command is basically like a templete. Memory is not Allocated tell you uses it. So think of Struct as a templete overlayed on the memory you allocated.

So.

struct info
{
int name = [15];
int age = [2];
int birthdate = [6];
}datos;

//Not memory the size of the stucture is allocated yet. mybe some memory to hold the information of the stucture but not and actual 'info' struct.


info MyInfo=new info; //Borland C++ Builder Example.

or

info Myinfo=memalloc(sizeof(info)+1); //Just about any C example.

Not sure what the differences in embedded C is yet.

Myinfo.name ="bob"
Myinfo.age = 9
...

hope this helps.




List of 5 messages in thread
TopicAuthorDate
memory information using structs            01/01/70 00:00      
   You Need A C Book            01/01/70 00:00      
   Acessing struct            01/01/70 00:00      
   Struct            01/01/70 00:00      
      Avoid Malloc on 8051            01/01/70 00:00      

Back to Subject List