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 is p in text message?

1037


What is the use of c language in real life?

1070


Write a code to generate divisors of an integer?

1105


Is using exit() the same as using return?

1460


What do you mean by a local block?

1128


Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?

1310


What are the types of data files?

1252


Can you please explain the difference between exit() and _exit() function?

1083


What is the description for syntax errors?

1216


What is a stream water?

1281


What are local static variables?

1207


why do some people write if(0 == x) instead of if(x == 0)?

1125


Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

1224


Can we declare variables anywhere in c?

1053


Why is c called c not d or e?

1144