array init'ing, static or auto?

Ross Yahnke, MACC yahnke at vms.macc.wisc.edu
Sun Nov 12 15:56:27 AEST 1989


If I init a char array declared inside a function with a string:
  wubba()
  { char wubbaStr[] = "wubba";
  ...

when does actually get init'ed? When the function is called?

If wubba() got called a few thousand times, would it be faster
to make wubbaStr static instead?
  wubba()
  { static char wubbaStr[] = "wubba";

I'm assuming it would be cuz wubbaStr would get init'ed at program
load time, and not when the function is called... any comments?

>>>      Internet: yahnke at macc.wisc.edu        <<<
>>>   Mille voix chuchottent <<c'est vrai>>    <<<



More information about the Comp.lang.c mailing list