That is not going to give you the first digit..n will never be less than 0.
You might want to use a for loop to get one or two or three digits and so on..i would send another variable 'count' along with n to the function telling it to return n when n/(int)pow(10,count) is zero. So, then for your number, it would return 3, then 34, then 345 and then 3456.

count would start with 1 and go on till whatever the number of digits in the number are.