/my_programs

School and personal programs. Feel free to take a look and contribute! :)

Primary LanguageC

This is my personal school stuff, compiled with gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0.

RIP conio.h, you were a real one... Not.

Compiling and running

Steps to compile a C program.

In case you need help setting up, click here.

All programs

Just make, bro. :)

make

To compile a little faster

The command nproc tells you how many thread you have on your computer.

nproc

Running make -j will speed up the process, based on the number of threads on your computer.

make -j${nproc}

make will build all source files present in /src.

To run any program, in this case let's assume it's hello.c

./build/hello

In case you want to erase all build artifacts,

make clean

make clean will erase all build artifacts, allowing you to make again.

Individual program

If you're compiling and running on Turbo C++, please don't forget to do the following steps.

  #include <stdio.h>
+ #include <conio.h>

  void main()
  {
      int a, b, c;
+     clrscr();
      ...
      ...
+     getch();
  }

You need to include conio.h, and use the functions clrscr() before printing statements, and getch() at the bottom.

  • Compiling.

    • Let's assume you're compiling hello.c,
    gcc hello.c -o hello.o
    • In other places, replace hello.c and hello.o with the appropriate file name.
    • By default, running this command won't create the output file in build dir, it'll be in the src dir, unless you make or use a more complex command.
  • Running.

    • Again, assuming you're running hello.c
      ./hello.o

And that's it. Enjoy :)

Help Center:

In case you need help setting up your environment.

Credits:

All people who helped in one way or the other.

  • anyone who wrote these programs (me, and everyone who contributed).
  • ChatGPT for writing the Makefile (yes I got desperate).
  • my C lecturer.
  • Vineet Choudhary.