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?
Answers were Sorted based on User's Feedback
Answer / srinivasroyal
In CPP the above declaration is correct. But in case of C it
is not.
Is This Answer Correct ? | 7 Yes | 2 No |
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 |
how to construct a simulator keeping the logical boolean gates in c
Which node is more powerful and can handle local information processing or graphics processing?
how to find that no is int or float?
What is the use of define in c?
What is null pointer constant?
how we do lcm of two no using c simple if while or for statement
What is null character in c?
write a program to display the numbers in the following 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4
A program to allow an input operand and operator from the operator and read on the display and output operand.
can we write a program in c for printf and scanf without using header file stdio.h
Write the syntax and purpose of a switch statement in C.
1. Write a C program to count the number of occurrence of a specific word in the given strings. (for e.g. Find how many times the word “live” comes in the sentence “Dream as if you’ll live forever, live as if you’ll die today ”)