is there a better option to strlen()
It is my understanding that 'strlen()' is recursive and is not the most efficient way to derive the length of a string. Would it be better to just use the maximum size of the string instead? Is there a more efficient way to do this?
Code:
char buffer[15]
~ code
for(int i=0; i<strlen(buffer);i++)
{ if(isdigit(buffer[i]==0)
{cout<< "This is not a valid number";}
}
// Or should I use
for(int i=0;i<15;i++)
{ if(isdigit(buffer[i])==0)
{cout<< "This is not a valid number";}
}
~ code