I declared this inside one function:

void function()
{
    ....
    static const int iLimit = GetLimit();
    int iL = a_MyArray[iLimit];
    ....
}

The code compiles ok in g++. What I want to know is whether the GetLimit function will be called only once (At the first call to function() ?). Plz help. Thanks

Nvm. It happens that way. It only gets called at the first time.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.