Document
Document
DEPARTMENT: MATHEMATICS
GMAIL: JOSEPH.J222B@GMAIL.COM
Page content
Abstract
1. Introduction
2. Programming language (generation types and where c falls in)
3. Programming paradise (types, where c falls in)
4. C programming language
5. Conclusion
Abstract
C Programming Language
The
It allows developers to break the code into smaller modules or functions that
can be reused and maintained.
Identifiers are the name given to a variable which is used to identify the
variable, function or any other user-defined elements in the code.
autovoid
elsecontinue
longgoto
switchsizeof
breakvolatile
enumdefault
registerif
typedefstatic
casewhile
externdo
returnint
unionstruct
charpack
floatconst
shortfor
unsignedsigned
Comments are part of the program that is not compiled or executed. The
comments are the text written along with the code to provide an explanation
or guidance to any reader or developer going through the code. The compiler
ignores these comments while executing the program.
C Program supports single-line comments which begin with “//” at the end of
the comment. For multi-line comments which are enclosed between “/*” and
“*/”. Comments increase the readability of the code.
C Program supports various data types to store values inside the variable.
There are three major types of data used in C Programming Language.
It consists of the most basic type of data represented using integers, float,
characters, double floating points, voids, etc.
3. Derived Types
These data types are derived from the primitive data types and are hence
known as derived data types. For example, function, array, pointer,
reference, etc.
Basics of C Language
Start your C programming with the “Hello World!” program in the table
below.
int main() {
printf(“Hello, world!\n”);
Output
If you want to start your career in programming then C++ program is the
best option to start learning programming. C++ is an extension of C
programming language which is more user-friendly and powerful. Enrol in our
Decode C++ with DSA Course to learn with interactive classes and hands-on
learning experience.
What is Algorithm in C?
An algorithm is a step-by-step procedure to solve a problem in C
programming. It creates a machine-friendly solution which can be executed
with simple C programs.
Reference:
The benefit of applications built with an interpreted language is that they can
run on any environment. In fact, one of the mantras of the Java language
when it was first released was “Write once, run anywhere,” as Java apps
were not tied to any one OS or architecture.
Reference:
Loops are a block of code that executes itself until the specified condition
becomes false. In this section, we will look in detail at the types of loops used
in C programming.
Loops allow the user to execute the same set of statements repeatedly
without writing the same code multiple times.
Loop makes the code readable and easier to understand, especially when
dealing with complex logic or large data sets.
Types of Loop in C
for loop
while loop
do while loop
for loop in C
for loop in C
Syntax
//code to be executed
#include <stdio.h>
int main() {
int I;
printf(“%d\n”, i+1);
}
return 0;
The above code prints the numbers from 1 to 10 using a for loop in C.
We know it will take 10 iterations to print 10 numbers so, we have used the
for loop.
I is initialized to 0.
The condition i<10 will be checked. It is true, therefore i+1 i.e. 1 gets
printed.
Output
10
while loop in C
Syntax
while(test condition){
//code to be executed
If the test condition inside the () becomes true, the body of the loop executes
else loop terminates without execution. The process repeats until the test
condition becomes false.
#include <stdio.h>
int main()
int I = 1;
printf(“%d\n”, i);
i++;
return 0;
The test condition, i<=10 is evaluated. If true, the body of the loop executes.
If the condition becomes false in the beginning itself, the program control
does not even enter the loop once.
10
do…while loop in C
Syntax
do{
//code to be executed
}while(test condition);
#include <stdio.h>
int main()
int I = 0;
do {
printf(“%d\n”, i+1);
i++;
return 0;
The above code prints numbers from 1 to 10 using the do while loop in C.
Output
10
Summary
Loops in C have a broad range of applications, from loop-driven algorithms to
iterative problem-solving. As demonstrated, the syntax for using these loops
is relatively straightforward, although their logic must be carefully explored
to determine advantage and ease of use.
Referenc:
PW Skills
9.Conclusion
Features of C Programming
Portability
Efficiency
Flexibility
Community Support
C programming is a versatile and powerful language with a rich history and
enduring popularity. Its efficiency, portability, and flexibility make it suitable
for a wide range of applications, from system software to game development
and scientific computing.
Author: Sebesta
Reference
Sebesta, R. W. (2019).
Edition: 12
Reference
PW skills