if and comparing with ==
<p>I'm all newbie to programming, so please help me out. It seems that result variable doesn't have a correct value. I know it's better to use <code>cin</code> and <code>cout</code> but my tutor has asked me to use <code>printf</code> and <code>scanf</code>.</p>

<p>if I change the code to printf("%d", result); I wil get:
Run-Time Check Failure #3 - The variable 'result' is being used without being initialized.
and if i change the code to scanf("%c", &amp;c); %c will get white space from the first scanf()!!! so i have to write it this way scanf("%c%*c", &amp;c); or this way scanf(" %c", &amp;c);. it seems that %c in contrast to %d or %f does not skip white space.</p>

<pre><code>#include&lt;stdio.h&gt;
#include&lt;conio.h&gt;

int main    ()
{
    int n1, n2;
    int result; 
    char c;
    printf("Lotfan addad aval ra vared konid\n");
    scanf("%d", &amp;n1);
    printf("Lotfan addad Dovom ra vared konid\n");
    scanf("%d", &amp;n2);
    printf("Please choose an operator\n");
    scanf("%c%*c", &amp;c);
    if (c=='+')
    {
        result=n1+n2;
    }
    else if (c=='-')
    {
        result=n1-n2;
    }
    else if (c=='*')
    {
        result=n1*n2;
    }
    else if (c=='/')
    {
        result=n1/n2;
    }
    //else 
    //{
        //printf("error");
    //}
    //printf("%d%c%d=%d" ,n1,c,n2,&amp;result);
    printf("%d", &amp;result);
    getch();
    return 0;
}
</code></pre>
