Hi,
In the second scenario what value is it printing when i have given extra parameter in scanf?
Does it vary from compiler to compiler?
Scenario : I
-------------
root@kaushik_Fedora11 ~/C/LET_US_C/ch-1> cat simple-interest.c
#include
void main ()
{
int p;
float i=0;
printf ("enter the principal amount\n");
scanf ("%d",&p);
i = (p*5*5)/100;
printf ("Interterest is : %f\n",i);
}
root@kaushik_Fedora11 ~/C/LET_US_C/ch-1> ./a.out
enter the principal amount
100
Interterest is : 25.000000
Scenario : II
-------------
> cat simple-interest.c
#include
void main ()
{
int p;
float i=0;
printf ("enter the principal amount\n");
scanf ("p:%d",&p);
i = (p*5*5)/100;
printf ("Interterest is : %f\n",i);
}
root@kaushik_Fedora11 ~/C/LET_US_C/ch-1> ./a.out
enter the principal amount
100
Interterest is : -9321198.000000