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 kind of structure is a house?
What is data structure in c and its types?
What is volatile variable in c?
Explain can you assign a different address to an array tag?
What is sizeof array in c?
How can my program discover the complete pathname to the executable from which it was invoked?
What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }
given post order,in order construct the corresponding binary tree
What are pointers? Why are they used?
Describe explain how arrays can be passed to a user defined function
Explain how do you determine whether to use a stream function or a low-level function?
Explain is it better to bitshift a value than to multiply by 2?
Explain the array representation of a binary tree in C.
What is meant by preprocessor in c?
write a c programming using command line argument,demonstrate set operation(eg;union,intersection,difference) example output is c:>setop 12 34 45 1 union 34 42 66 c:>setop 12 34 1 42 66 c:>setop 12 34 diff 12 56 67 78 setop 12 34