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

Define C in your own Language.

1084


What is adt in c programming?

1166


How does pointer work in c?

1125


Can we use any name in place of argv and argc as command line arguments?

1075


Should I learn data structures in c or python?

1026


Which is best linux os?

1028


What is sizeof array in c?

1061


Which control loop is recommended if you have to execute set of statements for fixed number of times?

1348


What is pointer and structure in c?

1184


What is %g in c?

1080


What is the difference between #include

and #include “header file”?

1034


What is the condition that is applied with ?: Operator?

1132


What is const keyword in c?

1165


is it possible to create your own header files?

1107


Explain how do you determine whether to use a stream function or a low-level function?

1089