Question
#include
#include
void modify(struct emp*);
struct emp
{
char emp[20];
int age;
};
int main()
{
struct emp e = {"Sanjay" , 35};
modify(&e);
printf("%s %d" , e.name , e.age);
return 0;
}
void modify(struct emp *p)
{
p ->age=p->age+2;
}
Point out the error in the program?
#include
#include
void modify(struct emp*);
struct emp
{
char emp[20];
int age;
};
int main()
{
struct emp e = {"Sanjay" , 35};
modify(&e);
printf("%s %d" , e.name , e.age);
return 0;
}
void modify(struct emp *p)
{
p ->age=p->age+2;
}
Answer: Option B
Was this answer helpful ?
The struct emp is mentioned in the prototype of the function modify() before declaring
the structure.To solve this problem declare struct emp before the modify() prototype.
Was this answer helpful ?
Submit Solution