How can I implement opaque (abstract) data types in C?
What's the difference between these two declarations?

struct x1 { ... };
typedef struct { ... } x2;

Answers were Sorted based on User's Feedback



How can I implement opaque (abstract) data types in C? What's the difference between these two..

Answer / phani kumar s

using the structures and the pointers
n structures the memory will be allocated for each object at
different locations struct x1 { ... };

Is This Answer Correct ?    4 Yes 0 No

How can I implement opaque (abstract) data types in C? What's the difference between these two..

Answer / 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

More C Interview Questions

Why is c so powerful?

0 Answers  


What is a pointer on a pointer in c programming language?

0 Answers  


main() { float f1=10.5; double db1=10.5 if(f1==db1) printf("a"); else printf("b") }

2 Answers   CSC,


What do you mean by a local block?

0 Answers   InterGraph,


There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?

0 Answers  


A MobileNumber is a VIP number if it satisfy the following conditions. The operator should be Vodafone. Atleast one 0 (Zero) should be exist in mobile number. The number should not end with 8. The single digit sum of all the digits in the number should be equal to 9. For example if the number is 9876543210, the sum is 9+8+7+...+1+0 = 45. Sum of 4+5 = 9. Write a method: private boolean isVIPMobileNumber(String mobileNum, String operator) mobileNum phone number operator mobile operator as bsnl, Vodafone

1 Answers  


Will Macros support multiple arguments ?

7 Answers   Oracle,


Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014  Npu university

0 Answers  


What is the use of f in c?

0 Answers  


simple c program for 12345 convert 54321 with out using string

7 Answers   TCS,


what will be the output of this program? #include<stdio.h> #define cube(x) x*x*x void main() { int i,j=5; i=cube(j+3); printf("i=%d",i); }

6 Answers   IBM,


A B C D E F G F E D C B A A B C D E F F E D C B A A B C D E E D C B A A B C D D C B A A B C C B A A B B A A A

2 Answers  


Categories