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 a stream?
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
What is the difference between the expression “++a” and “a++”?
How do you view the path?
When can a far pointer be used?
What is double pointer in c?
How can I get back to the interactive keyboard if stdin is redirected?
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
What is the maximum no. of arguments that can be given in a command line in C.?
If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402
What is the ANSI C Standard?
to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference