Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What are the 4 data types?

1013


What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?

1335


Do you know the difference between malloc() and calloc() function?

1058


Differentiate between a structure and a union.

1288


Explain what is output redirection?

1191


Explain 'bus error'?

1091


How can you find out how much memory is available?

1068


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

2297


What is the use of extern in c?

1092


Explain what does the format %10.2 mean when included in a printf statement?

1360


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

1151


How are 16- and 32-bit numbers stored?

1287


Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

3538


Explain the use of function toupper() with and example code?

1127


What header files do I need in order to define the standard library functions I use?

1056