EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / Hi Ray,Yes, as soon as you

Hi Ray,Yes, as soon as you

|

Microcontroller › AVR › Structures and Memory › Hi Ray,Yes, as soon as you

December 10, 2013 at 5:19 am #10714
AJISH ALFRED
Participant

Hi Ray,

Yes, as soon as you declare the variable data, that much memory will get allocated. 

You can create a pointer by creating a pointer type ‘data’ like;

 

struct RealTimeData
{
.....
.....
}*data;

Use dynamic memory allocation with the help of malloc()

 

data = (struct RealTimeData*) malloc (sizeof (struct RealTimeData)); //you may need to                                                                                                             //modify this line

                                                                                                      //to get compiled

 

You can use it in code like

 

When I use this code…
 

void SpillTime(void)
{
data -> spillControlTime = 2100;
}

 

RSS Recent Posts

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 Arrowfly LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of Arrowfly
Privacy Policy | Advertising

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise