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
Differentiate between a structure and a union.
What is volatile variable how do you declare it?
How variables are declared in c?
What are pointers? What are stacks and queues?
What is 1d array in c?
in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above
Why c is called free form language?
What is the best style for code layout in c?
Explain can the sizeof operator be used to tell the size of an array passed to a function?
what do the 'c' and 'v' in argc and argv stand for?
Explain what is page thrashing?
Tell us the use of fflush() function in c language?
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
What is array within structure?
What is LINKED LIST? How can you access the last element in a linked list?