how is returning structurs from functions?Show an eg?



how is returning structurs from functions?Show an eg?..

Answer / ravi.g

struct student
{
int age;
float percntg;
};

struct student s1;

int a=25;
float p=88.99;
student assign(a,p)
{
student s2;
s2.age=a;
s2.percntg=p;
return s2;

}

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More C++ General Interview Questions

Is c++ vector dynamic?

0 Answers  


When is a template better solution than a base class??

2 Answers   emc2,


Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

0 Answers   CTS,


What is an incomplete type in c++?

0 Answers  


what is the size of a class which contains no member variables but has two objects??? is it 1 or 2??

4 Answers  






Write an algorithm that determines whether or not an almost complete binary tree is a heap.

0 Answers   TCS,


What is the purpose of template?

0 Answers  


When is a template a better solution than a base class?

1 Answers  


Is there a c++ certification?

0 Answers  


Which one is better- macro or function?

0 Answers   Fidelity,


what is oops

2 Answers  


What is the use of namespace std in C++?

0 Answers   Hexaware,


Categories