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
I have seen function declarations that look like this
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?
What is a structure member in c?
What is the difference between abs() and fabs() functions?
what is the significance of static storage class specifier?
What is a pointer value and address in c?
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
If null and 0 are equivalent as null pointer constants, which should I use?
Can you please explain the difference between exit() and _exit() function?
What is scope rule in c?
Why is c called c not d or e?
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
What is the size of structure pointer in c?
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?