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
Can the sizeof operator be used to tell the size of an array passed to a function?
What are header files? What are their uses?
What is extern storage class in c?
What is scope and lifetime of a variable in c?
define string ?
What is adt in c programming?
What is unary operator?
hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.
In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping
What is uint8 in c?
write a program fibonacci series and palindrome program in c
how should functions be apportioned among source files?
Why do some versions of toupper act strangely if given an upper-case letter?