can we declare a function inside the structure?
ex: struct book
{
int pages;
float price;
int library(int,float);
}b;
is the above declaration correct? as it has function
declaration?
Answers were Sorted based on User's Feedback
Answer / srinivasroyal
In CPP the above declaration is correct. But in case of C it
is not.
Is This Answer Correct ? | 7 Yes | 2 No |
no , it is not possible in C.. here structure is not a defined class.. so it is not permitted..
in C++ we can use , that is called class , A derived datatype from a structure :)
class class_name
{
ACCESS SPECIFIER : (private/public/protected)
decleration of data member;
member fucntions definitions
{
......
.........
}
};
thank u
Is This Answer Correct ? | 4 Yes | 3 No |
What is the use of sizeof?
Explain the difference between exit() and _exit() function?
what is difference between procedural language and functional language ?
Where are some collections of useful code fragments and examples?
Is c procedural or object oriented?
What is string function c?
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.
how to print value of e(exp1)up to required no of digits after decimal?
Is anything faster than c?
Print all numbers which has a certain digit in a certain position eg: number=45687 1 number=4 2 number=5 etc
What are the difference between a free-standing and a hosted environment?
What is I ++ in c programming?