Abstract Data Types in C

Posted zjbfvfv

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Abstract Data Types in C相关的知识,希望对你有一定的参考价值。

  • Interface declares operations, not data structure
  • Implementation is hidden from client (encapsulation)
  • Use features of programming language to ensure encapsulation

Common practice

  • Allocation and deallocation of data structure handled by module
  • Names of functions and variables begin with <modulename>_
  • Provide as much generality/flexibility in interface as possible
  • Use void pointers to allow polymorphism

#ifndef ARRAY_H

#define ARRAY_H

typedef struct Array *Array_T;

extern Array_T Array_new(void);

extern void Array_free(Array_T array);

extern void Array_insert(Array_T array, void *datap);

extern void Array_remove(Array_T array, void *datap);

以上是关于Abstract Data Types in C的主要内容,如果未能解决你的问题,请参考以下文章

Data Types in Java

All data types in Python are “reference type“

All data types in Python are “reference type“

MongoDB - The mongo Shell, Data Types in the mongo Shell

Detecting Unstable Periodic Orbits in Chaotic Experimental Data (解析)

Primitive Types in Go