Hi , Inside a recursive function i have a static variable, when i return that static variable , it's value becomes zero.
count = trimWS(someXMLNode);
i get count as 0 , but when i debug countWS was 9.
Pls help me why this is happening and what is the right way to return some value from recursive function.
example :
int trimWS(xmlNode pNode) {
static int countWS;
//trimming leading whitespaces
if(pNode == 0) {
return countWS;
}
while(pNode->name[0] != 0) {
if( pNode->name[0] == 9 || pNode->name[0]== 10 || pNode->name[0]== 13 || pNode->name[0]== 32) {
(pNode->name)++;
countWS++;
}else {
break;
}
trimWS(pNode->FChild);
}