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...

How can I implement opaque (abstract) data types in C?
What's the difference between these two declarations?

struct x1 { ... };
typedef struct { ... } x2;

Answer Posted / pankaj

Abstract data type in C can be implemented using structures :
struct abstract;
typedef struct abstract abstract_type;

Note that this didn't define the struct abstract fully, only an opaque struct. sizeof() can be used on it. Memory can be allocated by using some macros and typecasted into this type.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I have seen function declarations that look like this

1093


Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?

2597


What is a structure member in c?

1052


What is the difference between abs() and fabs() functions?

1178


what is the significance of static storage class specifier?

2343


What is a pointer value and address in c?

1183


disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit

2108


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

2049


If null and 0 are equivalent as null pointer constants, which should I use?

1311


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

1084


What is scope rule in c?

1122


Why is c called c not d or e?

1146


What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?

1330


What is the size of structure pointer in c?

1117


How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?

1158