As I'm just started learning C programming..
I'm posting simple program..
Code:
/* even if we go for returning a value instead of using void.. say return 0 */
#include <stdio.h>
void main()
{
int a,b,r;
printf("\nenter two numbers a,b to find the sum \n");
scanf("%d %d",&a,&b);
r=a+b;
printf("%d",&r);
}
Do edit if it has some minor errors (sometimes happen while writing )..
what i found is when i open the .exe file of this program, it is taking the input but immediately closing after that..
why ??
As I'm a beginner please explain me in detail and clearly why it happens and how do i write code to make sure that it works the way I said