pritf_scanf problem

main()

{

float a,b;

scanf("%d %d",&a,&b);

printf(“a=%f b=%f”,a,b);

}

this code has “garbage value” error. but with below code

main()

{

int a,b;

scanf("%f %f",&a,&b);

printf(“a=%d b=%d”,a,b);

}

has run time error… ??

I am sure you are not using GCC compiler .
I tried both your codes here and both of them shows only warnings and not runtime error . In case 1 : Answer is shown as 0.000000 for both and case 2: answer is some garbage value

@ghulam >> I don’t know what you’re trying to do, but with my experience I can say that both of the code snippets will give you two warnings like format ‘%d’ expects argument of type ‘int’ but it has type ‘double’ and corresponding warning in the other case, but it will just run after that if you run it, without any runtime error! Try it and then come back.