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
What is p in text message?
What is the use of c language in real life?
Write a code to generate divisors of an integer?
Is using exit() the same as using return?
What do you mean by a local block?
Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?
What are the types of data files?
Can you please explain the difference between exit() and _exit() function?
What is the description for syntax errors?
What is a stream water?
What are local static variables?
why do some people write if(0 == x) instead of if(x == 0)?
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Can we declare variables anywhere in c?
Why is c called c not d or e?