0
double shrDelta(int iCounterID = 0){     //this is the 27  the line

    double DeltaT;            
    static struct timeval _NewTime;  
    static struct timeval _OldTime[3]; 
    gettimeofday(&_NewTime, NULL);  

    if (iCounterID >= 0 && iCounterID <= 2)
        {        

        DeltaT =  ((double)_NewTime.tv_sec + 1.0e-6 * (double)_NewTime.tv_usec) - ((double)_OldTime[iCounterID].tv_sec + 1.0e-6 * (double)_OldTime[iCounterID].tv_usec);        

        _OldTime[iCounterID].tv_sec  = _NewTime.tv_sec;     
        _OldTime[iCounterID].tv_usec = _NewTime.tv_usec;        
        }   
    else        
        {         

        DeltaT = -9999.0;       
        }     

    return DeltaT;
} 

The function is supposed to return the time elapsed between last two calls.

Barmar
  • 741,623
  • 53
  • 500
  • 612
Piyush Kumar
  • 157
  • 1
  • 2
  • 14

2 Answers2

3

C does not support defaulting of function parameters (or function overloading for that matter).

You need to write

double shrDelta(int iCounterID)

instead and always call the function with the parameter value explicitly given.

Bathsheba
  • 231,907
  • 34
  • 361
  • 483
2

C standard doesnt support default values. what you used is a C++ concept. you can read this related question

Community
  • 1
  • 1
LearningC
  • 3,182
  • 1
  • 12
  • 19