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 mean of c languages.
Program to display given 3 integers in ascending order
What is the size of array float a(10)?
Can we add pointers together?
what is difference between overriding and overloading?
what is the use of c program?
4 Answers Synergy, Web Synergies,
write a program to display & create a rational number
how to multiply two number taking input as a string (considering sum and carry )
What will be the output of following program #include main() { int x,y = 10; x = y * NULL; printf("%d",x); }
What is class and object in c?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
What are c identifiers?