What is the difference between following statements
What is the difference between following 2 scanf statements,
#include<stdio.h>
void main()
{
int a,b;
clrscr();
printf("\n Enter values for a and b");
scanf("%d",&a); // Format specifier as %d
scanf("%i",&b); // Format specifier as %i
printf("\n a is %d and b is %i",a,b);
getch();
}
I given values a as 10 and b as 20. It is giving same values as an output,
So my questions are
what is the difference between %d and %i.??
What about the memory for each variable ??
Is there is any difference between %d and %i as a format specifier ???
No comments:
Post a Comment