What is missing in the following C program include void main

What is missing in the following C program? #include void main() {int x, y, z; x = 2; y = 3; z = add(x, y); printf(\"Addition is %d\", z);} int add(int a, int b) {int c; c = a + b; return c;} (a) Function Prototype (b) Function Call (c) Function Definition (d) None What is wrong in the following C program? #include void add(int, int); void main() {int x, y, z; x = 2; y = 3; z = add(x, y); printf(\"Addition is %d\", z);} int add(int a, int b) {int c; c = a + b; return c;} (a) Function Call is wrong (b) Function Return Type (c) Function Prototype (d) None

Solution

4) need to declare funtion prototype

#include<stdio.h>
int add(int,int);
void main(){
   int x,y,z;
   x=2;y=3;
   z=add(x,y);
   printf(\"Addition is %d\",z);
}
int add(int a, int b){
   int c;
   c=a+b;
   return c;
}

**************

5) function return type is different because function type declared as void but returning int and catching int

#include<stdio.h>
void add(int,int);
void main(){
   int x,y,z;
   x=2;y=3;
   z=add(x,y);// here is the error return void but catching int
   printf(\"Addition is %d\",z);
}
void add(int a, int b){
   int c;
   c=a+b;
   return c;
}

 What is missing in the following C program? #include void main() {int x, y, z; x = 2; y = 3; z = add(x, y); printf(\

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site