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
What is the purpose of void pointer?
What is the use of function in c?
What does the c preprocessor do?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
What does do in c?
What is scope and lifetime of a variable in c?
What does s c mean in text?
What is the correct code to have following output in c using nested for loop?
How to draw the flowchart for structure programs?
What is string function in c?
How can I determine whether a machines byte order is big-endian or little-endian?
What is the use of a conditional inclusion statement in C?
Where does the name "C" come from, anyway?
What are directives in c?
What is static and auto variables in c?