SlideShare a Scribd company logo
1 of 18
Download to read offline
Basic Information About C Language [Updated]
blogwaping.com/2020/07/c-language.html
Do you want to learn basic information about thec Language?
Yes!
That’s great.
This article is the right choice for you.
Here, I will provide you all the basic information about C language.
Introduction Of C Language
C is a high-level computer programming language.
It is also known as:
Mother programming language
System programming language
Mid-level programming language
Procedure-oriented programming language
Structured programming language
Usually, this language is designed to be compiled with a relatively simple
compiler.
It provides low-level access to memory.
1/18
So, it requires minimum runtime support to process instructions.
If you learn this language, another programming language iseasy to
understand for you.
History Of C Language
It is interesting to know the history of the C language.
Here, I discuss abrief history of the c language.
It was originally invented byDennis Ritchie in 1972 at AT & T’s Bell
Laboratory in the USA.
It was primarily developed to writingUNIX operating system.
Gradually, it becomes a verypopular programming language in the
worldwide.
It has been standardized by theAmerican National Standards Institute
(ANSI) since 1989 and subsequently by the International Organization for
Standardization (ISO).
Timeline of C language development
2/18
Version Name Year Developer
C 1972 Dennis Ritchie
K&R C 1978 Brian Kernighan & Dennis Ritchie
ANSI C 1989 ANSI Committee
ISO C 1990 ISO Committee
C99 1999 Standardization Committee
C11 2011 Standardization Committee
C18 2017/2018 Standardization Committee
Features Of C Language
There are different types of features are available in the C language.
All the features are not possible to mention in one article.
Although, some of the key features are mentioned here:
Fast and Efficient
Easy to Extend
Procedural Language
Simple and clean style
Middle-Level Language
Low-level access to memory
Libraries with rich Functions
Rich set of built-in Operators
A simple set of keywords
Support memory management
3/18
These features make C language suitable for system programs like an
operating system or compiler development.
Later programming languages have borrowedsyntaxes and features directly
or indirectly from C language.
Java, PHP, JavaScript, and many other programming languages are mainly
based on C language.
Note: C++ is almost a superset of C (very few programs can be compiled with
C, but not with C++).
Data Types
Each variable contains a specific data type.
Data types are used to define thedata storage format.
Each data type requires different amounts of memory space and has some
specific features.
There are mainly 4 data types that are mostly used in c programming.
4/18
Those are described here.
int: It is used to store an integer type value (numbers).
char: It stores a single character (alphabets).
float: It is used to store decimal numbers (floating-point value) with
single precision.
double: It is also used to store decimal numbers (floating-point value)
with double precision.
An int is signed by default.
It means it can represent bothpositive and negative values.
On the other hand, anunsigned int can never be negative.
All data types are listed here.
Data Type Memory
(Bytes)
Range Format
specifier
short int 2 -32768 to 32767 %hd
unsigned short int 2 0 to 65535 %hu
unsigned int 4 0 to 4294967295 %u
int 4 -2147483648 to
2147483647
%d
long int 8 -2147483648 to
2147483647
%ld
unsigned long int 8 0 to 4294967295 %lu
long long int 8 -(2^63) to (2^63)-1 %lld
unsigned long long
int
8 0 to
18446744073709551615
%llu
signed char 1 -128 to 127 %c
unsigned char 1 0 to 255 %c
float 4 %f
double 8 %lf
long double 16 %Lf
5/18
You can also use the sizeof() operator to check thesize of any variable.
Variables
A variable is a simple word or letter that allocates some space in memory.
Basically, a variable used to store some different types of data.
Different types of variables require different amounts of memory and have
some specific set of operations that can be applied to them.
/*variable declaration*/
int a;
char b;
float c;
Rules For Defining Variables
1. A variable can have any alphabet, digit, and underscore.
2. A variable name must start only with the alphabet, and underscore. It
can’t start with a digit.
3. No space is allowed within the variable name.
4. A variable name can not be any reserved word or keyword. (e.g. int,
void, etc.)
Arrays
An array is a data structure that contains the same types of data items.
A variable can carry only one data item at a time.
If you want to store multiple data items in a data type, you need to use an
array.
You can not initialize an array with more elements than the specified size.
The specified size is declared to the left of the variable between thethird
brackets.
6/18
A one-dimensional array is like a row list.
On the other hand, atwo-dimensional (2D) array is like a table.
Arrays consist of contiguous memory locations.
Array Declaration
1. Array declaration by specifying the size
int a[5];
2. Array declaration by initializing the elements
int a[] = { 10, 20, 30, 40 };
3. Array declaration by specifying the size and initializing the
elements
int arr[5] = { 10, 20, 30, 40 };
Note: You can use While or For loops to add values in the variables.
Pointers
A pointer is a variable that stores theaddress of another variable.
For example, an integer variable stores an integer value, however an integer
pointer stores the address of an integer variable.
We use the unary operator & (ampersand) that returns theaddress of a
variable.
7/18
#include <stdio.h>
int main()
{
int x;
printf("%p", &x);
return 0;
}
Here, &x print the address of variable x.
Keywords
Keywords are specificreserved words in C which attached with a specific
feature.
The list of keywords includes almost all the words that can help us to use the
functionality of the C language.
C does not contain very large number of keywords.
However, there are 32 keywords are available inC98 language.
auto break case char const
continue default do double else
enum extern float for goto
if int long register return
short signed sizeof static struct
switch typedef union unsigned void
volatile while
C99 reserved five more keywords.
_Bool _Imaginary restrict _Complex inline
C11 reserved seven more keywords.
_Alignas _Atomic _Noreturn _Thread_local _Alignof
_Generic _Static_assert
8/18
Most of the recently reserved words begin with anunderscore followed by a
capital letter.
Because identifiers of that form were previously reserved by the C standard for
use only by implementations.
Operators
C supports a rich set of operators, which are different types of symbols.
Each operator performs a specific operation with a variable.
All operators are listed in the following table.
Operator Name Operator Symbol
Arithmetic +, -, *, /, %
assignment =
augmented assignment +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>=
bitwise logic ~, &, |, ^
bitwise shifts <<, >>
boolean logic !, &&, ||
conditional evaluation ? :
equality testing ==, !=
calling functions ( )
increment and decrement ++, —
member selection ., ->
object size sizeof
order relations <, <=, >, >=
reference and dereference &, *, [ ]
sequencing ,
subexpression grouping ( )
type conversion (typename)
9/18
These operators tell the compiler to perform specificmathematical or
logical operations.
Memory Management
The most important function of a programming language is to provide
facilities for managing memory and objects that are stored in memory.
C language provides 3 unique ways to allocate memory for objects.
Static Memory Allocation
This is an allocation technique that allocates a fixed amount of memory during
compile time.
Dynamic Memory Allocation
This is also an allocation technique that manages system memory at
runtime.
Automatic Memory Allocation
When you declare an automatic variable (such as a function argument or a
local variable), then it happens.
Libraries
Library functions are inbuilt functions in C language that are grouped
together in common files. This file is called the C standard library.
Each library provides specific functions to perform specific operations.
We can use these library functions to get the pre-defined output instead of
writing your own huge complex code to get those outputs.
All C standard library functions are declared in header files which are saved as
filename.h.
10/18
We are including the library in theheader files in our C program.
#include<filename.h>
The command allow to use of the functions that are declared in the header
files.
Basic Structure Of C Program
A set of rules is defined for the C programs that are calledprotocols.
The protocols help us to design the basic structure of a program.
Here, I mentioned thebasic structure of a C program.
Documentation section
Link section
Definition section
Global declaration section
Main function section
Sub-program section
All C programmers must follow theprotocols when writing any program.
Let’s discuss all thebasic structure sections of a C program.
Documentation Section
The documentation section is a part of the program where the programmers
provide the details about the program.
In this section programmers usually give thename of the program and the
details related to the program.
This code gives an overview of the program.
//program name
/*This is a
C Program*/
Link Section
This section is used todeclare all theheader files that will be used in the
program.
11/18
It tells the compiler tolink the header files to the system library.
#include<stdio.h>
Definition Section
In this section, we can define different types of constants.
The keyword define is used to define a constant value in this part.
#define PI=3.14
Global Declaration Section
All the global variables are declared in this section.
User-defined functions are also declared in this section of the code.
int a,b,c;
Main Function Section
Every C-programs must have the main function.
The main function contains 2 parts.
1. Declaration Part: All thevariables are declared in this part.
2. Execution Part: This part starts with thecurly brackets and ends with
the curly close bracket.
Both the declaration and the execution part are writing inside the curly
braces.
int main()
{
int a=5;
printf(" %d", a);
return 0;
}
Sub-program Section
All user-defined functions are defined in this section.
12/18
int add(int a, int b)
{
return a+b;
}
Hello World C Program
This is the source code of a basic “Hello World” Program.
13/18
#include<stdio.h>
int main()
{
/*First basic C Program*/
printf("Hello World.");
getch();
return 0;
}
After compiling the source code the output will be the following:
Output:
Hello World.
Explanation of “Hello World” C Program
Here, I explained each line of the “Hello World” C program.
#include <stdio.h>
This is a preprocessor command that includes the inputheader file from the
C library before compiling a program.
int main()
This is the main function of executing any C program begins.
{
It represents the beginning of the main program.
/*First basic C Program*/
If any words exist inside the command/* and */ in any C program that won’t
be considered for compilation and execution. This is also called a comment
line.
printf(“Hello World.“);
The printf command displays the words in the quote on the screen.
getch();
This function is used to hold the output screen and wait until the user gives
any type of input. So that we are able to see the output on the screen.
return 0;
14/18
Here, the return is a keyword that is used to return some value from a
function.
The main function returns an integer value, therefore here we are returning
0.
It means our program has beenrun successfully and we terminate ourmain
function with this return statement.
}
It represents the ending of the main program.
Create a C Program
Are you want to create and execute a C programs yourself?
Then you need to follow the instructions:
1. At first, you need toinstall a C supported IDE (Integrated Development
Environment) on your computer.
2. Once the IDE is installed on your computer, you canopen and create a
C program.
If you don’t want to install theIDE on your computer, you can use anonline
compiler or IDE.
The good thing about theonline compiler is it can compileC, C++, C#,
Java, and many other programming languages.
We also provide some links to the online and offlineIDE in this article that
can help you to create and execute your C program easily.
Best IDE For C
15/18
You can create and edit C programs with any code editor or even a general
editor.
Yet, it is very important to choose thebest IDE for beginners.
If the IDE is integrated with the C compiler, the process ofcreating and
compiling the C program will be easier.
Anyway, we collect some best IDE for c program that can help you to write
and execute any c program easily.
Here are some collection,
Run C Program Online
Onlinegdb IDE
Tutorialspoint IDE
Rextester IDE
Run C Program On Android Phone
TruboCdroid
Cxxdroid
TurboCPlus
CppDroid
Run C Program On Windows
Turbo C++
Dev C++
16/18
Code::Blocks IDE
Run C Program In Mac OS
Turbo C++
Code::Blocks IDE
Run C Program In Linux
Code::Blocks IDE
Choose the best IDE that makes youcomfortable to create and edit the C
program.
Thus, your programming skills will increase and you will be able tocreate
any program within a few minutes.
Advantages Of C Language
It is one of the most useful programming languages when the system
requires quick and direct access to the hardware.
C is the most commonly used system withlimited resources (such as
memory).
Where performance is the most important attribute, C is the best
choice for programmers.
Disadvantages Of C Language
C does not support OOP (Object-oriented programming) concepts, that’s
why C++ is developed.
There is no runtime checking ability in the C language. It only does
compile-time checking.
It does not support the concept of thenamespace. We cannot declare
two variables of the same name without namespace.
It does not have the concept ofconstructor and destructor.
Uses Of C Language
There are different types of uses of C language in programming.
Some uses are the following:
17/18
C mainly used to develop system software, operating systems, BIOS,
Embedded Systems, Real-time systems.
To develop application software like databases (MySQL) and 3D
software (Autodesk Maya).
Used to create graphical related applications like computers and mobile
games.
To evaluate any types of logical and mathematical equations using c
language.
UNIX kernel is completely made in C Language.
The language is used to design different languagecompilers.
Conclusion
The C language doesn’t seem to have anexpiration date.
It has a closeness to thehardware, great portability, and deterministic
usage of resources.
For these features, it is theideal programming language for low-level
development of things like operating system kernels and embedded software.
Its good performance, efficiency, and versatility make it anexcellent choice
to develop highly complex data manipulation software like MySQL, 3D
animation, and more.
C is still unsurpassed where performance is the main priority.
I hope now you know all thebasic information about the C language.
18/18

More Related Content

What's hot

Basic C Programming language
Basic C Programming languageBasic C Programming language
Basic C Programming languageAbhishek Soni
 
Features of c language 1
Features of c language 1Features of c language 1
Features of c language 1srmohan06
 
C programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer CentreC programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer Centrejatin batra
 
OpenGurukul : Language : C Programming
OpenGurukul : Language : C ProgrammingOpenGurukul : Language : C Programming
OpenGurukul : Language : C ProgrammingOpen Gurukul
 
Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)Rohit Singh
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Functionimtiazalijoono
 
Introduction to C Programming - I
Introduction to C Programming - I Introduction to C Programming - I
Introduction to C Programming - I vampugani
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_outputAnil Dutt
 

What's hot (20)

Basic C Programming language
Basic C Programming languageBasic C Programming language
Basic C Programming language
 
Features of c language 1
Features of c language 1Features of c language 1
Features of c language 1
 
The smartpath information systems c pro
The smartpath information systems c proThe smartpath information systems c pro
The smartpath information systems c pro
 
Tokens_C
Tokens_CTokens_C
Tokens_C
 
C Language
C LanguageC Language
C Language
 
C programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer CentreC programming Training in Ambala ! Batra Computer Centre
C programming Training in Ambala ! Batra Computer Centre
 
C notes for exam preparation
C notes for exam preparationC notes for exam preparation
C notes for exam preparation
 
Structures
StructuresStructures
Structures
 
OpenGurukul : Language : C Programming
OpenGurukul : Language : C ProgrammingOpenGurukul : Language : C Programming
OpenGurukul : Language : C Programming
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
 
C program
C programC program
C program
 
Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)Learn c language Important topics ( Easy & Logical, & smart way of learning)
Learn c language Important topics ( Easy & Logical, & smart way of learning)
 
C language
C language C language
C language
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
C language introduction
C language introduction C language introduction
C language introduction
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Function
 
Introduction to C Programming - I
Introduction to C Programming - I Introduction to C Programming - I
Introduction to C Programming - I
 
Features of c
Features of cFeatures of c
Features of c
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_output
 
Basic c
Basic cBasic c
Basic c
 

Similar to Basic Information About C language PDF

Interview Questions For C Language .pptx
Interview Questions For C Language .pptxInterview Questions For C Language .pptx
Interview Questions For C Language .pptxRowank2
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxLikhil181
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language Rowank2
 
Unit 2 introduction to c programming
Unit 2   introduction to c programmingUnit 2   introduction to c programming
Unit 2 introduction to c programmingMithun DSouza
 
C programming language
C programming languageC programming language
C programming languageAbin Rimal
 
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...Rowank2
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptxmadhurij54
 
C prog ppt
C prog pptC prog ppt
C prog pptxinoe
 
C programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdfC programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdfComedyTechnology
 
1. overview of c
1. overview of c1. overview of c
1. overview of camar kakde
 
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshuunit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshuGauravRawat830030
 
unit2.pptx
unit2.pptxunit2.pptx
unit2.pptxsscprep9
 

Similar to Basic Information About C language PDF (20)

Interview Questions For C Language .pptx
Interview Questions For C Language .pptxInterview Questions For C Language .pptx
Interview Questions For C Language .pptx
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
 
Interview Questions For C Language
Interview Questions For C Language Interview Questions For C Language
Interview Questions For C Language
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
Aniket tore
Aniket toreAniket tore
Aniket tore
 
Unit 2 introduction to c programming
Unit 2   introduction to c programmingUnit 2   introduction to c programming
Unit 2 introduction to c programming
 
C notes
C notesC notes
C notes
 
C programming language
C programming languageC programming language
C programming language
 
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
C Language Interview Questions: Data Types, Pointers, Data Structures, Memory...
 
unit 1 cpds.pptx
unit 1 cpds.pptxunit 1 cpds.pptx
unit 1 cpds.pptx
 
C language ppt
C language pptC language ppt
C language ppt
 
C prog ppt
C prog pptC prog ppt
C prog ppt
 
C programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdfC programming language tutorial for beginers.pdf
C programming language tutorial for beginers.pdf
 
Presentation 2.ppt
Presentation 2.pptPresentation 2.ppt
Presentation 2.ppt
 
C tutorials
C tutorialsC tutorials
C tutorials
 
history of c.ppt
history of c.ppthistory of c.ppt
history of c.ppt
 
1. overview of c
1. overview of c1. overview of c
1. overview of c
 
C intro
C introC intro
C intro
 
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshuunit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
 
unit2.pptx
unit2.pptxunit2.pptx
unit2.pptx
 

Recently uploaded

AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfryanfarris8
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and ApplicationsWSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and ApplicationsWSO2
 
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...WSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2
 
WSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2
 
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...WSO2
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of TransformationWSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of TransformationWSO2
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAMWSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAMWSO2
 

Recently uploaded (20)

AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and ApplicationsWSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
 
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
WSO2Con2024 - Facilitating Broadband Switching Services for UK Telecoms Provi...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million PeopleWSO2Con2024 - Unleashing the Financial Potential of 13 Million People
WSO2Con2024 - Unleashing the Financial Potential of 13 Million People
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - Kanchana
 
WSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration Tooling
 
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
WSO2Con2024 - Navigating the Digital Landscape: Transforming Healthcare with ...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of TransformationWSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAMWSO2Con2024 - Organization Management: The Revolution in B2B CIAM
WSO2Con2024 - Organization Management: The Revolution in B2B CIAM
 

Basic Information About C language PDF

  • 1. Basic Information About C Language [Updated] blogwaping.com/2020/07/c-language.html Do you want to learn basic information about thec Language? Yes! That’s great. This article is the right choice for you. Here, I will provide you all the basic information about C language. Introduction Of C Language C is a high-level computer programming language. It is also known as: Mother programming language System programming language Mid-level programming language Procedure-oriented programming language Structured programming language Usually, this language is designed to be compiled with a relatively simple compiler. It provides low-level access to memory. 1/18
  • 2. So, it requires minimum runtime support to process instructions. If you learn this language, another programming language iseasy to understand for you. History Of C Language It is interesting to know the history of the C language. Here, I discuss abrief history of the c language. It was originally invented byDennis Ritchie in 1972 at AT & T’s Bell Laboratory in the USA. It was primarily developed to writingUNIX operating system. Gradually, it becomes a verypopular programming language in the worldwide. It has been standardized by theAmerican National Standards Institute (ANSI) since 1989 and subsequently by the International Organization for Standardization (ISO). Timeline of C language development 2/18
  • 3. Version Name Year Developer C 1972 Dennis Ritchie K&R C 1978 Brian Kernighan & Dennis Ritchie ANSI C 1989 ANSI Committee ISO C 1990 ISO Committee C99 1999 Standardization Committee C11 2011 Standardization Committee C18 2017/2018 Standardization Committee Features Of C Language There are different types of features are available in the C language. All the features are not possible to mention in one article. Although, some of the key features are mentioned here: Fast and Efficient Easy to Extend Procedural Language Simple and clean style Middle-Level Language Low-level access to memory Libraries with rich Functions Rich set of built-in Operators A simple set of keywords Support memory management 3/18
  • 4. These features make C language suitable for system programs like an operating system or compiler development. Later programming languages have borrowedsyntaxes and features directly or indirectly from C language. Java, PHP, JavaScript, and many other programming languages are mainly based on C language. Note: C++ is almost a superset of C (very few programs can be compiled with C, but not with C++). Data Types Each variable contains a specific data type. Data types are used to define thedata storage format. Each data type requires different amounts of memory space and has some specific features. There are mainly 4 data types that are mostly used in c programming. 4/18
  • 5. Those are described here. int: It is used to store an integer type value (numbers). char: It stores a single character (alphabets). float: It is used to store decimal numbers (floating-point value) with single precision. double: It is also used to store decimal numbers (floating-point value) with double precision. An int is signed by default. It means it can represent bothpositive and negative values. On the other hand, anunsigned int can never be negative. All data types are listed here. Data Type Memory (Bytes) Range Format specifier short int 2 -32768 to 32767 %hd unsigned short int 2 0 to 65535 %hu unsigned int 4 0 to 4294967295 %u int 4 -2147483648 to 2147483647 %d long int 8 -2147483648 to 2147483647 %ld unsigned long int 8 0 to 4294967295 %lu long long int 8 -(2^63) to (2^63)-1 %lld unsigned long long int 8 0 to 18446744073709551615 %llu signed char 1 -128 to 127 %c unsigned char 1 0 to 255 %c float 4 %f double 8 %lf long double 16 %Lf 5/18
  • 6. You can also use the sizeof() operator to check thesize of any variable. Variables A variable is a simple word or letter that allocates some space in memory. Basically, a variable used to store some different types of data. Different types of variables require different amounts of memory and have some specific set of operations that can be applied to them. /*variable declaration*/ int a; char b; float c; Rules For Defining Variables 1. A variable can have any alphabet, digit, and underscore. 2. A variable name must start only with the alphabet, and underscore. It can’t start with a digit. 3. No space is allowed within the variable name. 4. A variable name can not be any reserved word or keyword. (e.g. int, void, etc.) Arrays An array is a data structure that contains the same types of data items. A variable can carry only one data item at a time. If you want to store multiple data items in a data type, you need to use an array. You can not initialize an array with more elements than the specified size. The specified size is declared to the left of the variable between thethird brackets. 6/18
  • 7. A one-dimensional array is like a row list. On the other hand, atwo-dimensional (2D) array is like a table. Arrays consist of contiguous memory locations. Array Declaration 1. Array declaration by specifying the size int a[5]; 2. Array declaration by initializing the elements int a[] = { 10, 20, 30, 40 }; 3. Array declaration by specifying the size and initializing the elements int arr[5] = { 10, 20, 30, 40 }; Note: You can use While or For loops to add values in the variables. Pointers A pointer is a variable that stores theaddress of another variable. For example, an integer variable stores an integer value, however an integer pointer stores the address of an integer variable. We use the unary operator & (ampersand) that returns theaddress of a variable. 7/18
  • 8. #include <stdio.h> int main() { int x; printf("%p", &x); return 0; } Here, &x print the address of variable x. Keywords Keywords are specificreserved words in C which attached with a specific feature. The list of keywords includes almost all the words that can help us to use the functionality of the C language. C does not contain very large number of keywords. However, there are 32 keywords are available inC98 language. auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while C99 reserved five more keywords. _Bool _Imaginary restrict _Complex inline C11 reserved seven more keywords. _Alignas _Atomic _Noreturn _Thread_local _Alignof _Generic _Static_assert 8/18
  • 9. Most of the recently reserved words begin with anunderscore followed by a capital letter. Because identifiers of that form were previously reserved by the C standard for use only by implementations. Operators C supports a rich set of operators, which are different types of symbols. Each operator performs a specific operation with a variable. All operators are listed in the following table. Operator Name Operator Symbol Arithmetic +, -, *, /, % assignment = augmented assignment +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>= bitwise logic ~, &, |, ^ bitwise shifts <<, >> boolean logic !, &&, || conditional evaluation ? : equality testing ==, != calling functions ( ) increment and decrement ++, — member selection ., -> object size sizeof order relations <, <=, >, >= reference and dereference &, *, [ ] sequencing , subexpression grouping ( ) type conversion (typename) 9/18
  • 10. These operators tell the compiler to perform specificmathematical or logical operations. Memory Management The most important function of a programming language is to provide facilities for managing memory and objects that are stored in memory. C language provides 3 unique ways to allocate memory for objects. Static Memory Allocation This is an allocation technique that allocates a fixed amount of memory during compile time. Dynamic Memory Allocation This is also an allocation technique that manages system memory at runtime. Automatic Memory Allocation When you declare an automatic variable (such as a function argument or a local variable), then it happens. Libraries Library functions are inbuilt functions in C language that are grouped together in common files. This file is called the C standard library. Each library provides specific functions to perform specific operations. We can use these library functions to get the pre-defined output instead of writing your own huge complex code to get those outputs. All C standard library functions are declared in header files which are saved as filename.h. 10/18
  • 11. We are including the library in theheader files in our C program. #include<filename.h> The command allow to use of the functions that are declared in the header files. Basic Structure Of C Program A set of rules is defined for the C programs that are calledprotocols. The protocols help us to design the basic structure of a program. Here, I mentioned thebasic structure of a C program. Documentation section Link section Definition section Global declaration section Main function section Sub-program section All C programmers must follow theprotocols when writing any program. Let’s discuss all thebasic structure sections of a C program. Documentation Section The documentation section is a part of the program where the programmers provide the details about the program. In this section programmers usually give thename of the program and the details related to the program. This code gives an overview of the program. //program name /*This is a C Program*/ Link Section This section is used todeclare all theheader files that will be used in the program. 11/18
  • 12. It tells the compiler tolink the header files to the system library. #include<stdio.h> Definition Section In this section, we can define different types of constants. The keyword define is used to define a constant value in this part. #define PI=3.14 Global Declaration Section All the global variables are declared in this section. User-defined functions are also declared in this section of the code. int a,b,c; Main Function Section Every C-programs must have the main function. The main function contains 2 parts. 1. Declaration Part: All thevariables are declared in this part. 2. Execution Part: This part starts with thecurly brackets and ends with the curly close bracket. Both the declaration and the execution part are writing inside the curly braces. int main() { int a=5; printf(" %d", a); return 0; } Sub-program Section All user-defined functions are defined in this section. 12/18
  • 13. int add(int a, int b) { return a+b; } Hello World C Program This is the source code of a basic “Hello World” Program. 13/18
  • 14. #include<stdio.h> int main() { /*First basic C Program*/ printf("Hello World."); getch(); return 0; } After compiling the source code the output will be the following: Output: Hello World. Explanation of “Hello World” C Program Here, I explained each line of the “Hello World” C program. #include <stdio.h> This is a preprocessor command that includes the inputheader file from the C library before compiling a program. int main() This is the main function of executing any C program begins. { It represents the beginning of the main program. /*First basic C Program*/ If any words exist inside the command/* and */ in any C program that won’t be considered for compilation and execution. This is also called a comment line. printf(“Hello World.“); The printf command displays the words in the quote on the screen. getch(); This function is used to hold the output screen and wait until the user gives any type of input. So that we are able to see the output on the screen. return 0; 14/18
  • 15. Here, the return is a keyword that is used to return some value from a function. The main function returns an integer value, therefore here we are returning 0. It means our program has beenrun successfully and we terminate ourmain function with this return statement. } It represents the ending of the main program. Create a C Program Are you want to create and execute a C programs yourself? Then you need to follow the instructions: 1. At first, you need toinstall a C supported IDE (Integrated Development Environment) on your computer. 2. Once the IDE is installed on your computer, you canopen and create a C program. If you don’t want to install theIDE on your computer, you can use anonline compiler or IDE. The good thing about theonline compiler is it can compileC, C++, C#, Java, and many other programming languages. We also provide some links to the online and offlineIDE in this article that can help you to create and execute your C program easily. Best IDE For C 15/18
  • 16. You can create and edit C programs with any code editor or even a general editor. Yet, it is very important to choose thebest IDE for beginners. If the IDE is integrated with the C compiler, the process ofcreating and compiling the C program will be easier. Anyway, we collect some best IDE for c program that can help you to write and execute any c program easily. Here are some collection, Run C Program Online Onlinegdb IDE Tutorialspoint IDE Rextester IDE Run C Program On Android Phone TruboCdroid Cxxdroid TurboCPlus CppDroid Run C Program On Windows Turbo C++ Dev C++ 16/18
  • 17. Code::Blocks IDE Run C Program In Mac OS Turbo C++ Code::Blocks IDE Run C Program In Linux Code::Blocks IDE Choose the best IDE that makes youcomfortable to create and edit the C program. Thus, your programming skills will increase and you will be able tocreate any program within a few minutes. Advantages Of C Language It is one of the most useful programming languages when the system requires quick and direct access to the hardware. C is the most commonly used system withlimited resources (such as memory). Where performance is the most important attribute, C is the best choice for programmers. Disadvantages Of C Language C does not support OOP (Object-oriented programming) concepts, that’s why C++ is developed. There is no runtime checking ability in the C language. It only does compile-time checking. It does not support the concept of thenamespace. We cannot declare two variables of the same name without namespace. It does not have the concept ofconstructor and destructor. Uses Of C Language There are different types of uses of C language in programming. Some uses are the following: 17/18
  • 18. C mainly used to develop system software, operating systems, BIOS, Embedded Systems, Real-time systems. To develop application software like databases (MySQL) and 3D software (Autodesk Maya). Used to create graphical related applications like computers and mobile games. To evaluate any types of logical and mathematical equations using c language. UNIX kernel is completely made in C Language. The language is used to design different languagecompilers. Conclusion The C language doesn’t seem to have anexpiration date. It has a closeness to thehardware, great portability, and deterministic usage of resources. For these features, it is theideal programming language for low-level development of things like operating system kernels and embedded software. Its good performance, efficiency, and versatility make it anexcellent choice to develop highly complex data manipulation software like MySQL, 3D animation, and more. C is still unsurpassed where performance is the main priority. I hope now you know all thebasic information about the C language. 18/18