thanx buddy...
that was helpful...
well i have one more doubt...
the method you gave above is cool if i take input from stream...
what if i pass a decimal or hexadecimal integer to a function from my main function..and then have to decide in that function whether the argument is a decimal or hexadecimal value...
for ex:
int main()
{
int count=2;
int x[]={0x620058, 0x665eaf};// or int x[]={123,44};
func(x,count);
return 0;
}
the func is....
void func(int x[],int count)
{
int a;
for(int i=0;i<count;i++)
a+=x;
}
here , how do i make sure that the integers passed in an array to the func() are in decimal or hexadecimal form???