I tried to use switch statement with function into it.Cant make out where i made error .
Program :
Code:
#include<stdio.h>
void main()
{
int a,b,sum,mul;
int i;
printf("enter the value of a,b ");
scanf("%d%d",&a,&b);
printf("1.ADD 2.MULTIPLY");
scanf("%d",&i);
sum=add(a,b);/*function calling*/
printf("the value is %d",sum);
mul=pli(a,b);/*function calling*/
printf("the value is %d",mul);
}
switch(i)/*quite confused with this part of code*/
{
case 1:
add(int x, int y)/*fuction called*/
{
int z;
z=x+y;
return(z);
break;
}
case 2:
pli(int k,int l)/*function called*/
{
int m;
m=k*l;
return(m);
break;
}
}
Error:
Syntax error switch: