Tuesday, August 11, 2020

automate the process of compiling using clang with "make"

 for example:

make hello


....make executes clang with various command-line arguments


execute the resulting executable:

make hello



specify executable file name for clang compiler

 clang -o hello hello.c


-o is a "command-line argument", or a "flag" , or a "switch"





run a program from the command line in Unix

 ./a.out



clang - C compiler

 clang stands for "C language"


for example:

clang hello.c



ls command in Unix

 ls stands for "list"



hello world program in C

 #include <stdio.h>

int main(void)

{

printf("hello, world\n");

}



standard i/o library in C

 stdio.h


#include <stdio.h>



"cd" Unix command

 cd stands for "change directory"

an example would be:

cd ~/dir1



"mkdir" Unix command

 mkdir stands for "make directory"

an example would be: 

mkdir ~/directory1



Commands in Unix are case sensitive

 This means that a capital letter and a lower case letter are treated as different



"~" in Unix command Line

 ~  represents the home directory in Unix command line