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 |
which operator having lowest precedence?? a.)+ b.)++ c.)= d.)%
what is difference between procedural language and functional language ?
Can stdout be forced to print somewhere other than the screen?
What is Memory leakage ?
write a program that print itself even if the source file is deleted?
What are the scope of static variables?
what is pointer
What are volatile variables?
write a progrmm in c language take user interface generate table using for loop?
main() { int i; printf("%d",((i=1)*i-- - --i*(i=-3)*i++ + ++i)); } ans is 24 bt how?pls tell smbody............
What are the different categories of functions in c?
What is external variable in c?