INTRODUCTION to C
C is a general-purpose programming language that is extremely popular, simple and flexible. It is machine-independent, structured programming language which is used extensively in various applications.
C was the basic language to write everything from operating systems (Windows and many others) to complex programs like the Oracle database, Git, Python interpreter and more.
Why learn 'c'?
'C' is a base language for many programming languages. So, learning 'C' as the main language will play an important role while studying other programming languages. It shares the same concepts such as data types, operators, control statements and many more. 'C' can be used widely in various applications. It is a simple language and provides faster execution.
How 'c' Work?
A is a compiled language.
A compiler
is a special tool that compiles the program and converts it into the object
file which is machine readable. After the compilation process, the linker will
combine different object files and creates a single executable file to run the
program.
Where?
1. Visual
studio code (free source code editor)https://code.visualstudio.com/download
2.
https://www.electronicshub.org/download-turbo-cwindows/
3.
Dev C++
4.
Online gdb – online compiler
#include<stdio.h>................................ 1
Int main()........................... 2
{
3 printf(“Hello
world”);
return
0........................... 4
} ............................... 5
1.
Preprocessor
2. Int main()
3. Group all the related statements of the function main.
• Header file is a file that contains function declaration and
macro definition for C in-built library functions.
• All C standard library functions are declared in many header files
which are saved as
file_name.h.
• We are including these header files in our C program using
“#include <file_name.h>” command to make use of the functions those are declared in the header files.
• When we include header files in our C program using “#include
<filename.h>” command, all C code of the header files are
included in C program. Then, this C program is compiled by
compiler and executed.
#include<stdio.h>
• stdio is standard for input/output, this allows us to use some commands
which includes a
file called stdio.h. or
• This is a preprocessor command. That notifies the compiler to include
the header file stdio.h in the program before compiling the
source-code.
int/viod main()
• int/void is
a return value.
main()
• The main() is the main function where program execution begins. Every C program must contain only one main function. or
• This is the
main function, which is the default entry point for every C program and the
void in front of it indicates that it does not return a value.
Braces
• Two curly
brackets "{...}" are used to group all statements. or
• Curly
braces which shows how much the main() function has its scope.
return 0
At the end of the main function return value 0.
Comments
Post a Comment