Thank you for considering contributing to C-Numerical-Methods! This repository is dedicated to course assignments on Numerical Methods using the C programming language. We welcome contributions from both classmates and external contributors.
Before you start, please take a moment to review the guidelines outlined in this document to ensure a smooth and collaborative contribution process.
GNU/Linux enviornment is preferred. However it is possible to setup C development enviornment in Windows using mingw-w64 or MSYS 2.
Install Git, GCC/Clang in the system. For debian/Ubuntu, install the build-essential
package that bundles all the relevant packages.
- Fork the repository to your GitHub account.
- Clone the forked repository to your local machine:
git clone https://github.com/YOUR-USERNAME/C-Numerical-Methods.git
-
Switch to the dev branch:
git checkout dev
-
Make your changes, adhering to the coding standards.
-
Test your changes locally to ensure they work as expected.
-
Commit your changes:
git commit -m "Your descriptive commit message"
-
Push your branch to your GitHub fork:
git push
-
Open a pull request (PR) to the main repository targetting the dev branch. Be sure to reference any relevant issues.
-
C source file names must be in kebab case: hello-world.c
-
Follow the standard naming conventions for C programming:
- Trivial variables:
i
,n
,c
, etc. - Local variables: camelCase, be descriptive.
- Global variables:
g_camelCase
. - Macros and constants in caps:
MAX_BUFFER_SIZE
,TRACKING_ID_PREFIX
. - Pointer variables:
p_var
for local,gp_var
for global,fp_var
for far pointers. - Functions: camelCase.
- Trivial variables:
-
Avoid the use of global variables whenever possible.
To compile the code, you can use a C compiler such as Clang or GCC. The repository includes a Makefile for convenience. Use the following commands:
- To compile a debug binary from name-c-file.c source file:
make name-c-file
The debug build will be titled debug.out/debug.exe.
- To generate a release binary:
make release-name-c-file
The release build will create an optimized binary with the same name.
To run the compiled binary:
./debug.out
or for release builds
./release-file-name.out
Note: to use make
you need to have make installed.
By contributing to this project, you agree that your contributions will be licensed under the Apache License 2.0.
Happy coding!