Getting Started With C

From CsWiki
Revision as of 13:59, 5 August 2018 by Yoav.eshed (Talk | contribs) (introduction)

Jump to: navigation, search

introduction

This page describes the necessary surrounding for coding in c programming language and running your C code.
Coding in C language can be done in text editors such as (vim, gedit, nano),terminal in linux or mac, or visua studio in windows.
also available are IDE(Integrated Development Environment) programs, such as netbeans,code::blox,clion etc... Clion IDE by jetbrains is available at the Aquarium computers, w can be found at:

 applications Tab → Programming→ Clion. 













Clion.png
For external installation of clion,follow this guide for getting a student licence for jetbarins products, and then download and install Clion from jetbarins site. .
after installing Clion, a compiler is needed to be installed, preferably gcc wich is included in cgywin or minGW.

Compiling in C

Compiling is the process of converting one programing language to another. It is executed by a computer program called a compiler.
In The school’s computer system, GCC is the default compiler used by courses for compiling needs.

How to Compile With GCC

After finishing writing down the code in C , open the terminal , then select the folder where your file is saved by using :cd PATH/.
Then use the compiling command:

gcc -Wextra -Wall -Wvla -std=c11 file_name.c -o output_file_name.

if warnings are raised , the file may or may not be compiled. if the file has not compiled, the user will have
to handle the causes to the warnings and errors and after that try again until the warnings are gone.
else,the file will be compiled and an output file with the name you have designated will be created at the same
directory as the compiled file.
after all the warnings has been solved, in the termimal, select the file and press enter, and the file will
run at the terminal.
compiling exmaple, showing the command in terminal, where test.c is the c file that the user has wrote,
and result is the output file which was created in the compiling process and can run in the terminal

Compiling example.png