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 sequential access file?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
What is getch() function?
What tq means in chat?
What is #include conio h?
Calculate 1*2*3*____*n using recursive function??
What does do in c?
What are multidimensional arrays?
Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?
Write a program to print "hello world" without using a semicolon?
why return type of main is not necessary in linux
What is the correct declaration of main?
What is the best way of making my program efficient?
What is a example of a variable?
What is c value paradox explain?