C is a general-purpose, high level language that is capable of building softwaresembed systems and etc. It was originally developed by Dennis M Ritchie in 1972 at Bell Labs, Many languages are built on top of C. Is a high level language but it allows you to program close to the metal and is increasingsly important for embeded programming. C has its own standardizition it started with "K R" C then moved to ANSI C it was most portable(has the ability to use in different machines) for more about c standardizition follow this link http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html#C-Extensions .To run a C program without using an IDE like code blocks ,visual studio and etc you need to understand 4 stages of compilation process . The first one is PREPROCESSING the preprocessor create .c file then it tells the program to include heading or first line(directive) of the code for most program the first line is #include stdio.h but not in every case first line can differ depending on your program. The second step is COMPILER ,compiler reads the preprocessed code which is .c file and convert it to assembly code. You might be wondering what assembly code is? Assembly code is a code that is human readable it is written in plain english , in order for our computer to understand the code written in assembly it needs to convert it to binaries thats where 3rd step comes ASSEMBLER , assembler will convert plain english to zeros and one's(010101) this will create an object code and it will be easy for our computer to understand our code. The last stage is LINKING, the linker reads all the libraries in the code. Linker will link our object code with given libraries and produce an executable file. To understand more about compilation process use man gcc on your terminal if you are a linux user, note that this will be different in windows or mac . To compile a C program use gcc -o filename file.c to run it use ./filename . Now lets create a simple C program you need a text editor for example if you working with linux operating vi or vim could be a good text editor . Well in order to run a c program you need to follow different steps
1.open text editor
2.write the code you intend to run
3.compile and assemble your code
4.execute your code
Below is the example of a simple hello world code
#include stdio.h
int main(void)
{
printf("helloworld");
return(0);
}
to explain the above code i will start from the first line which represent the hearder file is the starting point of the code the header file tells the code about what types of variables and characters the code is going to use ,for now i have used standard library for input output values the next line is the entry point or main this works as starting point , then its followed by printf function .this function allows us to print or display output on the screen we can print different output on the screen using printf function you can use printf with text or numbers in it to display bunch of text ,story or even do some calculations and print them on the screen for example printf(''hello my name is gift/n''); this will print text as it is, '\' this represent a new line where as '/t' this represnt a horizantal tab, /" this represent a quote and pure space represent a space. Thats not the only way we can use to display output on the screen. On my next blog i will continue with format specifiers,puts function,putchar and getchar thank you reading don't hesitate to ask or add more please hit me on socials
Facebook: https://web.facebook.com/profile.php?id=100008396890903
Linkedin: https://www.linkedin.com/in/gift-mabasa-51a3301bb?lipi=urn%3Ali%3Apage%3Ad_flagship3_profile_view_base_contact_details%3BssmDVy5oRKCAgcid8tZO1A%3D%3D
HAPPY CODING