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 happens if a header file is included twice?
Explain modulus operator. What are the restrictions of a modulus operator?
Are enumerations really portable?
What is return in c programming?
write a program to print infinte number
what are two kinds of java
What is the difference between c and python?
What is the proper way of these job Tell me about there full work
What is operator promotion?
What is the use of pragma in embedded c?
Write a program to generate the first n terms in the series --- 2,3,5,7,11,...,17
What is #include stdlib h?