float mySqrt(float, int *); int main () { int counter = 0; float val; /* some code goes here */ print("value returned: %f, loops: %d", mySqrt(val, &counter), counter); /* ... */ } /* ... */ float mySqrt(float val, int *cnt) { /* count loops like that: *cnt = *cnt + 1; return root; /* the root we are looking for */ }