Giter Club home page Giter Club logo

scalper's Introduction

Scalper (CHelper)


What is it about?

  • A personal project that I wrote to make the lives of C programmers easier.
  • Mostly will be about rewriting C++ STL containers into ANSI C.
  • Code is compiled and tested as such:
gcc -Wall -Werror -Wextra -pedantic -ansi main.c -o main.exe
  • This is still C, so it is still not safe, definitely not for beginners.
  • Conversion is not going to be perfect, but I will strive to achieve it as close as possible.
  • Will be adding comments ASAP.

Donation

  • Donate
  • Send me a cup of coffee, deeply appreciate it. Shall turn caffeine into more code!

Basic Usage

CVector

#include "scalper.h"

int main()
{
  /* Creates an integer vector of max size 3 */
  CVECTOR(int) int_vector;
  CVECTOR_INIT(int_vector, 3);
  
  /* Pushes 5 into the vector, then removing it */
  CVECTOR_PUSHBACK(int_vector, 5);
  CVECTOR_POPBACK(int_vector);
  
  /* Deallocates the vector, call CVECTOR_INIT to use this vector again */
  CVECTOR_DELETE(int_vector);
  
  return 0;
}

CString

#include <stdio.h>
#include "scalper.h"

int main()
{
  /* Creates 2 string */
  CSTRING cs1;
  CSTRING cs2;
  CSTRING_INIT(&cs1, "Hello World");
  CSTRING_INIT(&cs2, "Goodbye Universe");

  /* Swap the 2 strings */
  CSTRING_SWAP(&cs1, &cs2);

  /* Outputs "Hello World" */
  printf("%s", CSTRING_DATA(&cs2));

  /* Deletes the strings */
  CSTRING_DELETE(&cs1);
  CSTRING_DELETE(&cs2);

  return 0;
}

scalper's People

Contributors

lamweilun avatar anikait1 avatar

Stargazers

Mohammed Hasanul Chowdhury avatar Daniel Cascais avatar Ivan Dyakin avatar Danielle Maywood avatar  avatar Jack Clarke avatar Noah avatar

Watchers

 avatar

Forkers

anikait1

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.