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 are the 4 data types?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
Do you know the difference between malloc() and calloc() function?
Differentiate between a structure and a union.
Explain what is output redirection?
Explain 'bus error'?
How can you find out how much memory is available?
Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon
What is the use of extern in c?
Explain what does the format %10.2 mean when included in a printf statement?
a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none
How are 16- and 32-bit numbers stored?
Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor
Explain the use of function toupper() with and example code?
What header files do I need in order to define the standard library functions I use?