Skip to content

Instantly share code, notes, and snippets.

View laughandbelly's full-sized avatar
🍤
learning

˖⁺‧₊˚♡ sparkle ♡˚₊‧⁺˖ laughandbelly

🍤
learning
View GitHub Profile
@laughandbelly
laughandbelly / 42-compile-run-c.md
Created July 28, 2023 03:51 — forked from seamicole/42-compile-run-c.md
A handy tool to compile, run, and test C files locally.

The C Compile-Run-Delete Tedium

Now that we are into C proper of our journey here at 42, we will be writing, testing, and reviewing C coding assignments. We want this process to be as fast and efficient as possible which is why it is in our interest to automate whatever we can.

Some assignments we write are not expected to include a main function upon submission, even though it is impossible to compile and test C code locally without one. For those of us who use Vim, we can make this process a little less painful than the current process. Many of us have found ourselves needing to carry out the following mindless steps:

  • Uncomment an existing test main function (or create a new one)
  • Switch terminals or exit out of Vim so that you have the command line accessible
  • Run cc -Wall -Wextra -Werror <filename> (which outputs an a.out file by default)
  • Run the default a.out file ./a.out so that you can check the output