C is mother language of all programming language.
It is a system programming language. It is a procedure-oriented programming language. It is also called mid-level programming language.
C evolved from a language called B, written by Ken Thompson at Bell Labs in 1970. Ken used B to write one of the first implementations of UNIX. B in turn was a descendant of the language BCPL (developed at Cambridge (UK) in 1967), with most of its instructions removed.
So many instructions were removed in going from BCPL to B, that Dennis Ritchie of Bell Labs put some back in (in 1972), and called the language C.
The famous book The C Programming Language was written by Kernighan and Ritchie in 1978, and was the definitive reference book on C for almost a decade.
The original C was still too limiting, and not standardized, and so in 1983, an ANSI committee was established to formalize the language definition.
It has taken until now (ten years later) for the ANSI ( American National Standard Institute) standard to become well accepted and almost universally supported by compilers.
C is mother language of all programming language.
It is a system programming language. It is a procedure-oriented programming language. It is also called mid-level programming language.
C evolved from a language called B, written by Ken Thompson at Bell Labs in 1970. Ken used B to write one of the first implementations of UNIX. B in turn was a descendant of the language BCPL (developed at Cambridge (UK) in 1967), with most of its instructions removed.
So many instructions were removed in going from BCPL to B, that Dennis Ritchie of Bell Labs put some back in (in 1972), and called the language C.
The famous book The C Programming Language was written by Kernighan and Ritchie in 1978, and was the definitive reference book on C for almost a decade.
The original C was still too limiting, and not standardized, and so in 1983, an ANSI committee was established to formalize the language definition.
It has taken until now (ten years later) for the ANSI ( American National Standard Institute) standard to become well accepted and almost universally supported by compilers.
At the end of this lecture students should be able to;
Describe features of C programming language.
Justify the terminology related to computer programming.
Define the editing, compiling, linking, debugging stages of C programming
Recognize the basic structure of a C program
Apply comments for C programs to improve readability.
C Programming
History of C Programming
Features of C Programming
More about C Programming
Advantages of C Programming
Disadvantages of C Programming
Write using C programming
At the end of this lecture students should be able to;
Describe features of C programming language.
Justify the terminology related to computer programming.
Define the editing, compiling, linking, debugging stages of C programming
Recognize the basic structure of a C program
Apply comments for C programs to improve readability.
C Programming
History of C Programming
Features of C Programming
More about C Programming
Advantages of C Programming
Disadvantages of C Programming
Write using C programming
structure of c program. everything about the structure is in this ppt...................................................................viearhgviuehdrgbvkejfsdbvaerhbgf;oiweHFGIO;WENEGV;KLADFN;OVIBNA;OINVO;IRANV;OINDF;LNVOIASRDNGVIOERNAVB EOANGVV ERNGOEWN
Fundamental of C Programming Language and Basic Input/Output Functionimtiazalijoono
Fundamental of C Programming Language
and
Basic Input/Output Function
contents
C Development Environment
C Program Structure
Basic Data Types
Input/Output function
Common Programming Error
This is a presentation on C language. Brief description on C language
Topics Covered
What is C
Header files in C
What is main function in c
Basic Structure of C
Keywords & Identifiers
Data Types & Variable Declaration in C Includes | Format Specifier | Memory Size
Input in C (printf() scanf() function)
Operators in C: Asthmatics,Increment Decrement, Relational, Logical operators
Sample Exercise
LinkedIn: https://www.linkedin.com/in/shamsulhusainansari/
GitHub: https://github.com/shamsulhusainansari
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
This presentation includes basic of PCOS their pathology and treatment and also Ayurveda correlation of PCOS and Ayurvedic line of treatment mentioned in classics.
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
1. LOGO
Higher Technological Institute
10th of Ramadan City
6th of October Branch
Electrical and Computer Engineering Department
Lecture Notes in
Prepaid By: Eng. Ibrahim Elewah
Main Reference
HTI Student Book and “C For Dummies”
by Dan Gookin 2nd Edition
1
2. Course Contents
1
Introduction
2
Program Development
3
The Essential of C Programs
4
Manipulating Data with Operators
5
Reading from and Writing to Standard I/O
6
Decision
7
Iteration
8
Arrays
9
C Functions
C Programming
2
Higher Technological Institute
3. Course Contents
3
The Essential of C Programs
Constants and variables
Expressions
Arithmetic operators
Statements
Statement blocks
Data Types and Names in C
Naming a Variable
C Programming
3
Higher Technological Institute
4. Expressions
o An expression is a combination of constants,
variables, and operators that are used to
denote computations
𝑨= 𝟐∗ 𝑨 − 𝟏
1. Taking the value contained in the drawer
(variable) A
2. Multiply this value by 2
3. Subtract 1 from result obtained from 2
4. The value contained in drawer A is omitted, then
putting the result obtained from 3 into drawer A.
C Programming
4
Higher Technological Institute
8. Constants and Variables
o As its name implies, a constant is a value that never
changes.
o A variable, on the other hand, can be used to present
different values.
o For instance, consider the following:
𝒊 = 𝟏 ;
o Where the symbol i is a constant because it always has
the same value (1) and the symbol i is assigned the
constant 1.
o In other words, i contains the value of 1 after the
statement is executed.
C Programming
8
Higher Technological Institute
9. Data Types and Names
o The C language reserves some keywords
words that have special meanings to the
language.
o Those reserved words should not be used
as variables, constants, or function names
in your program.
o All C keywords must be written in
lowercase letters, for instance INT will not
be treated as a keyword, it must be written
as int.
C Programming
9
Higher Technological Institute
10. The computer list of C keywords
auto
const
double
float
int
short
struct
unsigned
C Programming
break
continue
else
for
long
signed
switch
void
case
default
enum
goto
register
sizeof
typedef
volatile
10
char
do
extern
if
return
static
union
while
Higher Technological Institute
11. Naming a Variable
Valid Variable Name Can Use
o Characters A through Z and a through z
o Digit characters 0 through 9, which can be
used in any position except the first of a
variable name.
o The underscore character _
Examples
stop_sign
C Programming
loop3
11
and_pause
Higher Technological Institute
12. Naming a Variable
Invalid Variable Name Can NOT be Used
o
o
o
o
A variable name can’t contain any C arithmetic signs.
A variable name can’t contain any dots.
A variable name can’t contain any apostrophes.
A variable name can’t contain any other special
symbols such as *, @, #, and so on.
Examples
4flags
return
C Programming
sum-result
what_size?
12
method*4
ahmed.ali
Higher Technological Institute
13. Data Types
C Data Type
char
int
float
double
a, B, $, #
5, 17, 128
2.5 , 0.3
23433.3455
C Programming
13
Higher Technological Institute
18. Some special characters in C
b
Backspace
f
Form feed
n
New line
r
Return
t
Tab
C Programming
Moves the cursor to the left
one character
Goes to the top of a new
page
Carriage return and line
feeds
Returns to the beginning of
the current line
Advances to the next tab
stop
18
Higher Technological Institute
19. Examples
/* Example1 : Printing out characters */
# include <stdio.h>
/* the header file for the printf () function */
main ( )
{
/* the main function body till line 13 */
char c1;
/* declaration of the character variable c1 */
char c2;
/* declaration of the character variable c2 */
c1 = ‘A’; /* assigning c1 with the character constant A */
c2 = ‘a’; /* assigning c2 with the character constant a */
return 0;
}
C Programming
19
Higher Technological Institute
20. Examples
/* Example1 : Printing out characters */
# include <stdio.h>
/* the header file for the printf () function */
main ( )
{
/* the main function body till line 13 */
char c1;
/* declaration of the character variable c1 */
char c2;
/* declaration of the character variable c2 */
c1 = ‘A’;
/* assigning c1 with the character constant A */
c2 = ‘a’;
/* assigning c2 with the character constant a */
printf ( “ The character c1 is : %c n ”, c1);
printf ( “ The character c1 is : %c ” , c1);
printf ( “ while the character c2 is : %c n”, c2);
return 0;
}
C Programming
20
Higher Technological Institute
21. Examples
/* Example1 : Printing out characters */
# include <stdio.h>
/* the header file for the printf () function */
main ( )
{
/* the main function body till line 13 */
char c1;
/* declaration of the character variable c1 */
printf ( “ The character c1 is : variablen */”, c1);
%c c2
char c2;
/* declaration of the character
c1 = ‘A’;
/* assigning c1 with the character constant A */
c2 = ‘a’;
/* assigning c2 with the character constant a */
printf ( “ The character c1 is : %c n ”, c1);
printf ( “ The character c1 is : %c ” , c1);
printf ( “ while the character c2 is : %c n”, c2);
return 0;
}
C Programming
21
Higher Technological Institute
22. Examples
/* Example1 : Printing out characters */
# include <stdio.h>
/* the header file for the printf () function */
main ( )
{
/* the main function body till line 13 */
char c1;
/* declaration of the character variable c1 */
printf ( “ The character c1 is : variablen */”, c1);
%c c2
char c2;
/* declaration of the character
c1 = ‘A’;
/* assigning c1 with the character constant A */
c2 = ‘a’;
/* assigning c2 with the character constant a */
printf ( “ The character c1 is : %c n ”, c1);
printf ( “ The character c1 is : %c ” , c1);
printf ( “ while the character c2 is : %c n”, c2);
return 0;
}
C Programming
22
Higher Technological Institute
23. Examples
/* Example1 : Printing out characters */
# include <stdio.h>
/* the header file for the printf () function */
main ( )
{
/* the main function body till line 13 */
char c1;
/* declaration of the character variable c1 */
printf ( “ The character c1 is : variablen */”, c1);
%c c2
char c2;
/* declaration of the character
c1 = ‘A’;
/* assigning c1 with the character constant A */
c2 = ‘a’;
/* assigning c2 with the character constant a */
printf ( “ The character c1 is : %c n ”, c1);
printf ( “ The character c1 is : %c ” , c1);
printf ( “ while the character c2 is : %c n”, c2);
return 0;
}
C Programming
23
Higher Technological Institute
24. Examples
/* Example1 : Printing out characters */
# include <stdio.h>
/* the header file for the printf () function */
main ( )
{
/* the main function body till line 13 */
char c1;
/* declaration of the character variable c1 */
printf ( “ The character c1 is : variablen */”, c1);
%c c2
char c2;
/* declaration of the character
c1 = ‘A’;
/* assigning c1 with the character constant A */
c2 = ‘a’;
/* assigning c2 with the character constant a */
printf ( “ The character c1 is : %c n ”, c1);
printf ( “ The character c1 is : %c ” , c1);
printf ( “ while the character c2 is : %c n”, c2);
return 0;
}
New Line
Specifier
for
Character Data Type
C Programming
24
Higher Technological Institute
25. Examples
/* Example1 : Printing out characters */
# include <stdio.h>
/* the header file for the printf () function */
main ( )
{
/* the main function body till line 13 */
char c1;
/* declaration of the character variable c1 */
char c2;
/* declaration of the character variable c2 */
c1 = ‘A’;
/* assigning c1 with the character constant A */
c2 = ‘a’;
/* assigning c2 with the character constant a */
printf ( “ The character c1 is : %c n ”, c1);
printf ( “ The character c1 is : %c ” , c1);
printf ( “ while the character c2 is : %c n”, c2);
return 0;
}
C Programming
25
Higher Technological Institute
26. You Have To Know about Data Types
Type
Name
Value
Specifier
char
c1
‘&’
%c
int
n1
100
%d
float
f1
32/10
%f
double
d1
5e3
%e,%E
C Programming
26
Higher Technological Institute
27. Examples
/* The arithmetic operations on integers */
# include<stdio.h>
/* the header file for the printf () function */
main ( )
{
/* the main function body till line 15 */
int m = 3;
int n=2;
printf ( "The summation of %d and %d is : %d.n", m, n, m+n);
printf ( "The difference between %d and %d is : %d.n", m, n, m-n);
printf ( "The multiplication of %d by %d is : %d.n", m, n, m*n);
printf ( "The division of %d by %d is : %d.n", m, n, m/n);
printf ( "The remainder of division of %d by %d is : %d.n", m, n, m%n);
return 0 ;
}
C Programming
27
Higher Technological Institute
28. Operators Precedence
Operator Sign
( )
/
*
+
-
C Programming
Name
Brackets
Division
Multiplication
Addition
Subtraction
28
Higher Technological Institute
30. Examples
/* Example3 : Integer vs. floating point divisions */
# include <stdio.h>
/* the header file for the printf ()
function */
main ( )
{
int n1,n2,n3;
float m1,m2,m3;
n1 = 32/10;
m1= 32/10;
n2 = 32.0/10;
m2= 32.0/10;
n3 = 32/10.0;
m3 = 32/10.0;
return 0;
}
C Programming
30
Higher Technological Institute
31. Examples
/* Example3 : Integer vs. floating point divisions */
# include <stdio.h>
/* the header file for the printf () function */
main ( )
{
int n1,n2,n3;
float m1,m2,m3;
n1 = 32/10;
m1= 32/10;
n2 = 32.0/10;
m2= 32.0/10;
n3 = 32/10.0;
m3 = 32/10.0;
printf ( “ The integer division of 32/10 is :
%d n”, n1);
printf ( “The floating point division of 32/10 is :
%f n”, m1);
printf ( “The integer division of 32.0/10 is :
%d n”, n2);
printf ( “The floating point division of 32.0/10 is :
%f n”, m2);
printf ( “The integer division of 32/10.0 is :
%d n”, n3);
printf ( “The floating point division of 32/10.0 is :
%f n”, m3);
return 0;
}
C Programming
31
Higher Technological Institute
32. Double Data Type
o Here are two examples:
[mantissa] e [exponent]
[mantissa] E [exponent]
Example
5000
-300
0.0025
5e3.
-3e2
2.5e-3.
Specifier %e or %E
With printf ( )
C Programming
32
Higher Technological Institute
33. Precedence Example
# include<stdio.h>
main ( )
{
int A,B,C,D,E, X, Y, Z;
A = 20 ; B = 6 ;
C = 3 ; D = 10 ; E = 2 ;
X= E*D – B/C + A ;
Y=(E*D)–(B/C)+ A ;
Z= A*(D–B)/(C+ E);
printf ( “ X= %d n Y= %d n Z=%d n”, X,Y,Z);
return 0 ;
}
C Programming
33
Higher Technological Institute
34. Precedence Example
# include<stdio.h>
main ( )
{
int A,B,C,D,E, X, Y, Z;
A = 20 ; B = 6 ;
C = 3 ; D = 10 ; E = 2 ;
X= E*D – B/C + A ;
Y=(E*D)–(B/C)+ A ;
Z= A*(D–B)/(C+ E);
printf ( “ X= %d n Y= %d n Z=%d n”, X,Y,Z);
return 0 ;
}
C Programming
34
Higher Technological Institute
35. Precedence Example
# include<stdio.h>
X(
B/C + A ;
main = ) E * D –
{
int A,B,C,D,E, X, Y, Z;
A = 20 ; B = 6 ;
C = 3 ; D = 10 ; E = 2 ;
X= E*D – B/C + A ;
Y=(E*D)–(B/C)+ A ;
Z= A*(D–B)/(C+ E);
printf ( “ X= %d n Y= %d n Z=%d n”, X,Y,Z);
return 0 ;
}
C Programming
35
Higher Technological Institute
36. Precedence Example
X= E*D –
X= E*D –
C Programming
B/C
B/C
+ A ;
+ A ;
36
Higher Technological Institute
38. Precedence Example
X= E*D –
B/C + A ;
A = 20
B=6
C=3
D = 10
E=2
C Programming
( )
*
/
+-
38
Higher Technological Institute
39. Precedence Example
X= E*D –
2 * 10 –
A = 20
B/C + A ;
6 / 3 + 20
B=6
C=3
D = 10
E=2
C Programming
39
( )
*
/
+-
Higher Technological Institute
40. Precedence Example
X= E*D –
2 * 10 –
A = 20
B=6
C=3
D = 10
E=2
C Programming
20
B/C + A ;
6 / 3 + 20
–
2
40
+ 20
( )
*
/
+-
Higher Technological Institute
41. Precedence Example
X= E*D –
2 * 10 –
A = 20
B=6
C=3
D = 10
E=2
C Programming
20
B/C + A ;
6 / 3 + 20
–
2
38
41
+ 20
( )
*
/
+-
Higher Technological Institute
42. Precedence Example
# include<stdio.h>
main ( )
{
int A,B,C,D,E, X, Y, Z;
A = 20 ; B = 6 ;
C = 3 ; D = 10 ; E = 2 ;
X= E*D – B/C + A ;
Y=(E*D)–(B/C)+ A ;
Z= A*(D–B)/(C+ E);
printf ( “ X= %d n Y= %d n Z=%d n”, X,Y,Z);
return 0 ;
}
C Programming
42
Higher Technological Institute
43. Precedence Example
# include<stdio.h>
main ( )
{
int A,B,C,D,E, X, Y, Z;
A = 20 ; B = 6 ;
C = 3 ; D = 10 ; E = 2 ;
X= E*D – B/C + A ;
Y=(E*D)–(B/C)+ A ;
Z= A*(D–B)/(C+ E);
printf ( “ X= %d n Y= %d n Z=%d n”, X,Y,Z);
return 0 ;
}
C Programming
43
Higher Technological Institute
44. Precedence Example
# include<stdio.h>
main = )( E * D ) – ( B / C ) + A ;
Y (
{
int A,B,C,D,E, X, Y, Z;
A = 20 ; B = 6 ;
C = 3 ; D = 10 ; E = 2 ;
X= E*D – B/C + A ;
Y=(E*D)–(B/C)+ A ;
Z= A*(D–B)/(C+ E);
printf ( “ X= %d n Y= %d n Z=%d n”, X,Y,Z);
return 0 ;
}
C Programming
44
Higher Technological Institute
47. Precedence Example
# include<stdio.h>
main ( )
{
int A,B,C,D,E, X, Y, Z;
A = 20 ; B = 6 ;
C = 3 ; D = 10 ; E = 2 ;
X= E*D – B/C + A ;
Y=(E*D)–(B/C)+ A ;
Z= A*(D–B)/(C+ E);
printf ( “ X= %d n Y= %d n Z=%d n”, X,Y,Z);
return 0 ;
}
C Programming
47
Higher Technological Institute
48. Precedence Example
# include<stdio.h>
Z( = A * ( D – B ) / ( C + E ) ;
main )
{
int A,B,C,D,E, X, Y, Z;
A = 20 ; B = 6 ;
C = 3 ; D = 10 ; E = 2 ;
X= E*D – B/C + A ;
Y=(E*D)–(B/C)+ A ;
Z= A*(D–B)/(C+ E);
printf ( “ X= %d n Y= %d n Z=%d n”, X,Y,Z);
return 0 ;
}
C Programming
48
Higher Technological Institute
51. Precedence Example
Z= A*(D–B)/(C+ E);
A = 20
B=6
C=3
D = 10
E=2
C Programming
20 *
4
/
51
5
( )
*
/
+-
Higher Technological Institute
52. Precedence Example
Z= A*(D–B)/(C+ E);
A = 20
B=6
C=3
D = 10
E=2
C Programming
20 *
4
/
16
52
5
( )
*
/
+-
Higher Technological Institute
53. Precedence Example
# include<stdio.h>
main ( )
{
int A,B,C,D,E, X, Y, Z;
A = 20 ; B = 6 ;
C = 3 ; D = 10 ; E = 2 ;
X= E*D – B/C + A ;
Y=(E*D)–(B/C)+ A ;
Z= A*(D–B)/(C+ E);
printf ( “ X= %d n Y= %d n Z=%d n”, X,Y,Z);
return 0 ;
}
C Programming
53
Higher Technological Institute
54. Precedence Example
# include<stdio.h>
main ( )
{
int A,B,C,D,E, X, Y, Z;
A = 20 ; B = 6 ;
C = 3 ; D = 10 ; E = 2 ;
X= E*D – B/C + A ;
Y=(E*D)–(B/C)+ A ;
Z= A*(D–B)/(C+ E);
printf ( “ X= %d n Y= %d n Z=%d n”, X,Y,Z);
return 0 ;
}
C Programming
54
Higher Technological Institute
56. LOGO
Higher Technological Institute
10th of Ramadan City
6th of October Branch
Electrical and Computer Engineering Department
Eng. Ibrahim Elewah
Main Reference
HTI Student Book and “C For Dummies”
by Dan Gookin 2nd Edition
56