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?
Answer Posted / vignesh1988i
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 |
Post New Answer View All Answers
Define C in your own Language.
What is adt in c programming?
How does pointer work in c?
Can we use any name in place of argv and argc as command line arguments?
Should I learn data structures in c or python?
Which is best linux os?
What is sizeof array in c?
Which control loop is recommended if you have to execute set of statements for fixed number of times?
What is pointer and structure in c?
What is %g in c?
What is the difference between #include
What is the condition that is applied with ?: Operator?
What is const keyword in c?
is it possible to create your own header files?
Explain how do you determine whether to use a stream function or a low-level function?