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
How is a structure member accessed?
Define Spanning-Tree Protocol (STP)
What is ## preprocessor operator in c?
How can you be sure that a program follows the ANSI C standard?
What is double pointer in c?
How can you invoke another program from within a C program?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
What is the difference between test design and test case design?
What is the difference between array and structure in c?
how to find anagram without using string functions using only loops in c programming
What does sizeof int return?
What is c programing language?
Which built-in library function can be used to match a patter from the string?
Why do we use int main?
What is table lookup in c?