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 does it mean when a pointer is used in an if statement?
What are different types of operators?
Under what circumstances does a name clash occur?
When should you not use a type cast?
Is there a way to compare two structure variables?
What is malloc return c?
Why clrscr is used after variable declaration?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
What is the difference between array and linked list in c?
Explain what are reserved words?
What are the different types of linkage exist in c?
How can I trap or ignore keyboard interrupts like control-c?
Explain what is the benefit of using an enum rather than a #define constant?
Explain what is the difference between functions abs() and fabs()?
How can I manipulate strings of multibyte characters?