The return value of function returning long long unsigned int is incorrect
c
Solution
First -- pay attention to your compiler's warnings, they matter!
Answer -- since you didn't prototype `wordToInt()` before using it, the compiler warned you that it had not been prototyped and it assumed the function returned an int (which is smaller than a long long)... so you got an int value returned, rather than a long long. The value printed within the function is correct because the function knew the proper type.
Problem
When I call function `wordToInt(c)` from main, the return value is different from what it's printing inside the function. ``` main() { long long unsigned item; char c[6] = "ABCDE"; item = wordToInt(c); printf("Main The item is :%llu\n",item); } long long unsigned wordToInt(char *c) { long long unsigned int k,item=0; int i,len; int j,p=0; len = (int) strlen(c); for(i = len-1;i>=0;i--) { if(c[i] == 'c') j = 42; else if(c[i] == '*') j = 99; else j = (int) c[i]; j = j%100; k = pow(100,p); p++; item = item + (j*k); } printf("Function item is :%llu\n",item); return item; } ``` The output of the program is: ``` Function item is :6566676869 Main The item is :18446744071686293893 ``` Can anyone tell me why there is inconsistency in the output?