How to delay Global variable initilization
- From: vsnadagouda@xxxxxxxxx
- Date: 18 Oct 2005 06:43:56 -0700
Hello All,
I am looking for some way to delay the global variable initilization.
To make myself more clear, here is a simple example:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include <stdio.h>
int glob1, glob2;
struct test
{
int a;
int b;
};
struct test c_CF = { glob1,glob2};
int main ()
{
glob1=100;
glob2 = 200;
printf ("%d %d \n",c_CF.a, c_CF.b);
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
output: 0 0
+++++++++++++++++++++++++++++++++++++++++++++++++++++
Is there a way I can delay the global variable initilization until the
moment it is referred for the first time.
Thanks and Regards
-Vallabha
.
- Follow-Ups:
- Re: How to delay Global variable initilization
- From: Kenneth Brody
- Re: How to delay Global variable initilization
- From: Marc Boyer
- Re: How to delay Global variable initilization
- Prev by Date: Re: Help. Where is my error?
- Next by Date: Re: How to delay Global variable initilization
- Previous by thread: Watching a File for Changes
- Next by thread: Re: How to delay Global variable initilization
- Index(es):
Relevant Pages
|