I figured out my problem. I needed to add a ()s in line 38 to first subtract 48 from the value in the array and then multiply by k.
Code:
1 #include <stdio.h>
2 int main ()
3 {
4 int a;
5 a = getint ();
6 printf ("You entered ...%d", a);
7 printf ("Press any key to continue ...");
8 getch();
9 }
10 getint ()
11 {
12 int val,i,j,k;
13 char str[6];
14 i = 0;
15 while ( i <= 5)
6 printf ("You entered ...%d", a);
7 printf ("Press any key to continue ...");
8 getch();
9 }
10 getint ()
11 {
12 int val,i,j,k;
13 char str[6];
14 i = 0;
15 while ( i <= 5)
16 {
17 str[i] = getche();
18 if ( str[i] == '\r')
19 {
20 str[i]='\0';
21 break;
22 }
23 if ( str[i] == '\b')
24 {
25 printf ("\b");
26 i--;
27 }
28 else
29 {
30 printf ("You entered ....%d", str[i]);
31 i++;
32 }
33 }
34 val = 0;
35 k = 1;
36 for ( j = i-1; j >=0; j--)
37 {
38 val = val + ( (str[j] - 48) * k);
39 k = k * 10;
40 printf ("J is %d", j);
41 printf ("Here is what val is %d", val);
42 }
43 return val;
44 }