Code Monkey home page Code Monkey logo

c-stack-practice's Introduction

c-stack-practice

Different implementations of a stack data structure in C, inspired by JavaScript.

Usage

git clone [email protected]:Luzefiru/c-stack-practice.git
cd c-stack-practice

make start       # builds & runs the C implementation
make start-java  # builds & runs the Java implementation
make clean       # deletes .o & .class build artifacts

You'll need to run make start in a Bash instance or use GNUWin to add the make command to cmd.

  • add makefile scripts and descriptions

Changing the Implementation

We'll have to change the IMPLEMENTATION variable inside Makefile which points to the directory inside /src/stack/$(IMPLEMENTATION)/stack.c.

# the variable to change
IMPLEMENTATION := cursor # can also be list or array

# the compiled stack object code
stack.o:
	gcc -c ./src/stack/$(IMPLEMENTATION)/stack.c

File Structure

File directory structure follows the pitchfork convention used in big C++ and C projects.

Makefile                  # build scripts
src/
├── main.c                # driver program
└── stack/
    ├── array/
    │   └── stack.c       # array implementation
    ├── cursor/
    │   └── stack.c       # cursor-based list implementation
    ├── list/
    │   └── stack.c       # linked list implementation
    │
    └── java/             # Java implementation
        ├── Main.class    # Java driver program
        ├── Stack.class   # Stack class & method definitions
        └── IStack.class  # IStack interface imitating a header file
include/
└── stack.h               # included header file with function prototypes & documentation

Credits

c-stack-practice's People

Contributors

luzefiru avatar notrelix avatar kulaizki avatar samuel-bonghanoy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.