initialization of static variables ? 
Author Message
 initialization of static variables ?

On Mon, 19 Mar 2001 15:48:46 +0100, "Nikola Popovic"


>Hi .

>I know that if I declare variables as static ( in function as
>static variable , or outside any function as static storage
>class ) that are guaranteed to start out as zero.
>That is , integer variable would be = 0 , and pointer variable
>would be NULL .
>But , what with static structures , or static arrays ( or static
>array of structures )  ?

>If I have :
>static int a[10]


>static struct s {
>         int i;
>         float f;
>         char * p;


>static structure_type S[100]

>Is that mean that is GUARANTEED that every element of array
>or structure will be zero ( NULL ) ??

>Thanks in advance ,


Integer values will be 0, floating point values will be 0.0, pointers
will be NULL, and each will be in the correct form.

<<Remove the del for email>>

Mon, 08 Sep 2003 00:28:49 GMT  
 [ 1 post ] 

 Relevant Pages 

1. allocation and initialization of static variables

2. Is static variable initialization once is not enough........???

3. Initialization order for global and static variables

4. Is static variable initialization thread-safe?

5. static member variable initialization

6. struct initialization (with static, const static members)

7. Static Library static object initialization

8. static functions and non static variables

9. Static variable not instaniated in static library

10. static functions with non-static variables!

11. static local variables vs global variables

12. Initialization of non-static globals.


Powered by phpBB® Forum Software