Hi all,

I'm just learning C, and I started playing around with the double argument type. So I wrote a simple print/scan/print program to see how it works. My code is below.

Code:
#include <stdio.h>
#include <stdlib.h>

int main()
{
        double a;

        printf("\nEnter number: ");
        scanf("%lf", a);

        printf("%f", a);
}
I wrote this code according to my textbook, along with instructions from my professor on how to read the variable and how to call the variable for a print statement. However, I get seemingly conflicting errors when trying to compile:

>double_explore.c:9: warning: format ‘%lf’ expects type ‘double *’, but argument 2 has type >‘double’

So, I edit the code so that the "double a" in my declarations becomes "double *a". Then, compiling again, I get this error:

>double_explore.c:11: warning: format ‘%f’ expects type ‘double’, but argument 2 has type >‘double *’

Any ideas?

Thanks.

-Sean

P.S. Not sure if it matters, but in case it does, I'm running Ubuntu 10.10 and using vim to edit the code.