Click here to Skip to main content
15,894,050 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
#include<stdio.h>
#include<math.h>
int main()
{
	int a,b,c;
	printf("Enter two number to add \n");
	scanf("%d %d", &a, &b);
	c = a+b;
	printf("The addition of a and b is  %d", &c );
	return 0;
}


<-----Out for 2+3 is coming 2293316 ---->

What I have tried:

Changed VOID to Int. When I change it to VOID then it is showing me error that i should change it to int.
Posted
Updated 15-Aug-18 3:26am

1 solution

printf("The addition of a and b is  %d", c );


printf requires a value and not pointer.
 
Share this answer
 
Comments
gschahal 15-Aug-18 9:52am    
#include<stdio.h>
void main()
{
int a,b,c;
printf("Enter two number to add \n");
scanf("%d %d", &a, &b);
c = a+b;
printf("The addition of a and b is %d", c );
}

I changed it like this now the error is [Error]':: main' must return 'int'
jeron1 15-Aug-18 10:23am    
No one said to get rid of the 'return 0;' statement.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900