How to delay Global variable initilization



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

.



Relevant Pages