Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   Structure (http://www.velocityreviews.com/forums/t440812-structure.html)

Jake Thompson 01-09-2006 03:48 AM

Structure
 
Do you need to allocate a structure before you use it if it only holds
one instance and is not in array format?


pemo 01-09-2006 09:31 AM

Re: Structure
 

"Jake Thompson" <readytoride39@hotmail.com> wrote in message
news:1136778532.615050.165600@g43g2000cwa.googlegr oups.com...
> Do you need to allocate a structure before you use it if it only holds
> one instance and is not in array format?


How could you use it if it isn't declared/defined?



Benry 01-09-2006 04:38 PM

Re: Structure
 
Only if it contains a pointer, or anything that takes up memory. If a
struct just has an int or something in it, you don't have to allocate
any memory.


Default User 01-09-2006 05:21 PM

Re: Structure
 
Jake Thompson wrote:

> Do you need to allocate a structure before you use it if it only holds
> one instance and is not in array format?


What do you mean by "allocate". Please give an example.



Brian

--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.

Keith Thompson 01-09-2006 09:31 PM

Re: Structure
 
"Benry" <henrybg@gmail.com> writes:
> Only if it contains a pointer, or anything that takes up memory. If a
> struct just has an int or something in it, you don't have to allocate
> any memory.


Context is important; please read <http://cfaj.freeshell.org/google/>.

Of course you have to allocate memory for it. You can do so either by
calling an allocation function such as malloc(), or by declaring an
object (which implicitly allocates memory).

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.

Benry 01-12-2006 03:24 PM

Re: Structure
 
Keith Thompson wrote:
> "Benry" <henrybg@gmail.com> writes:
> > Only if it contains a pointer, or anything that takes up memory. If a
> > struct just has an int or something in it, you don't have to allocate
> > any memory.

>
> Context is important; please read <http://cfaj.freeshell.org/google/>.



Thank you, and I'm sorry!

-Ben



All times are GMT. The time now is 05:39 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.