I have reached two stumbling blocks while programming a calculator program. Although I am getting the right result from the calculator and printing properly for addition, subtraction and multiplication, I am just printing the `?` symbol for the result of division. Please refer to the code below.

```
static void calculate(int *val1, int *val2, char *op){
float a = *val1;
float b = *val2;
float c = a/b;

   /*
   A stands for addition, B for sub, C for mul, D for div
   I have already verified that the right operation is being
   performed
   */

if(strcmp(op,"A")==0)
    {
    printf("%i \n\r", *val1+*val2);
}else if(strcmp(op,"B")==0)
    {
    printf("%i \n\r", *val1-*val2);
}else if(strcmp(op,"C")==0)
    {
    printf("%i \n\r", *val1 * *val2);
}else if(strcmp(op,"D")==0)
    {
    printf("%f \n\r", c);
}
}  

```

I am using real term to print the results from my atmega 32 microcontroller.

In the debugger, I did confirm that float c has the right value when the operation selected by the user is Division "D" but it did not seem to have a decimal point associated with it although it is a float. 

2nd Question:

I was wondering whether I can use an array of chars (a string) like this:

```
//please note that below I am just simulating user keystrokes on a keypad attached to a
//microcontroller just for simplifying the problem.

  char a[20] = {1,2,3,4,5,\n};
  FILE keypad_str = FDEV_SETUP_STREAM(NULL, a, _FDEV_SETUP_READ);

```

What I am trying to above is trying to come up with a strategy to enable me to print out each user key press right away rather than making `keypad_str` the `stdin` and then printing out the entire string of user entered command on the screen.