Carmen Code
 All Classes Files Functions Variables Macros Pages
Functions
DigitNumber.cpp File Reference

This function returns the number of digits of an integer. More...

#include "Carmen.h"
Include dependency graph for DigitNumber.cpp:

Functions

int DigitNumber (int arg)
 Returns the number of digits of the integer arg. More...
 

Detailed Description

This function returns the number of digits of an integer.

Function Documentation

int DigitNumber ( int  arg)

Returns the number of digits of the integer arg.

Parameters
argArgument
Returns
int
23 {
24  int result;
25  int i;
26 
27  result = 0;
28  i = arg;
29 
30  while(i != 0)
31  {
32  i/=10;
33  result++;
34  }
35 
36  return result;
37 }

Here is the caller graph for this function: