Re: Automatically generate variables



On 13 Feb 2007 08:35:59 -0800, in comp.lang.c , "Nate"
<nverbeek@xxxxxxxxxxxxx> wrote:

Hello,

I am looking for a method to automatically declare variables in C.
I'm not sure if there is a good way to do this,

There isn't - you can't define object names at runtime in C.

You could mallocate an array of objects however, and size it to
whatever size you needed. This is likely to be more useful anyway as
the chances are you will need to loop over the variables.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
.



Relevant Pages

  • Re: Automatically generate variables
    ... I am looking for a method to automatically declare variables in C. ... Beep beep. ... "Debugging is twice as hard as writing the code in the first place. ...
    (comp.lang.c)
  • Re: Horrid Serial Dacs
    ... >Debugging is twice as hard as writing the code in the first place. ...
    (sci.electronics.design)
  • Re: Types
    ... "Debugging is twice as hard as writing the code in the first place. ... false and it irritate me: ...
    (comp.lang.c)
  • Re: char* pname = "Harry"
    ... Mark McIntyre ... "Debugging is twice as hard as writing the code in the first place. ...
    (comp.lang.c)
  • Re: Newbie question - displaying trivia questions at random
    ... Mark McIntyre ... "Debugging is twice as hard as writing the code in the first place. ...
    (comp.lang.c)