Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Structure

Reply
Thread Tools

Structure

 
 
Jake Thompson
Guest
Posts: n/a
 
      01-09-2006
Do you need to allocate a structure before you use it if it only holds
one instance and is not in array format?

 
Reply With Quote
 
 
 
 
pemo
Guest
Posts: n/a
 
      01-09-2006

"Jake Thompson" <> wrote in message
news: 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?


 
Reply With Quote
 
 
 
 
Benry
Guest
Posts: n/a
 
      01-09-2006
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.

 
Reply With Quote
 
Default User
Guest
Posts: n/a
 
      01-09-2006
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.
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      01-09-2006
"Benry" <> 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- <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.
 
Reply With Quote
 
Benry
Guest
Posts: n/a
 
      01-12-2006
Keith Thompson wrote:
> "Benry" <> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between c structure and c++ structure raghunandan_1081@yahoo.com C++ 9 11-11-2011 07:34 AM
How to read a Structure from a matlab file to a structure in Vc++ 2003 meisterbartsch C++ 2 06-12-2007 08:47 PM
Memory allocation in Structure to Structure pra_ramli@rediffmail.com C++ 2 03-09-2006 05:51 AM
Copy String structure "A" to string structure "B" Leo Nunez C Programming 3 02-09-2005 05:14 AM
Pointers to structure and array of structure. Excluded_Middle C Programming 4 10-26-2004 05:39 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57