Programming in C - 01 - Introduction.pdf
-
Upload
jonathan-mayamiko-nsapato -
Category
Documents
-
view
224 -
download
0
Transcript of Programming in C - 01 - Introduction.pdf
-
8/17/2019 Programming in C - 01 - Introduction.pdf
1/19
Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Programming Intr
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
2/19
Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Why Learn C?
Skills translate smoothly to other languages
• Many languages are based on C concepts and syn
It’s been in wide spread use for decades
• Lots of existing code is written in C
• Chances of seeing C code in a software developmecareer is very high
Relatively low level• Learning C makes more advanced languages easie
understand
• Starting at the Object Oriented (OO) level does notexpose programmers to many aspects of programm
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
3/19
Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
What is C?
Programming language originally written for
Developed in the early 1970s by Bell Labs Main focus was for System Software develop
• Operating Systems
• Drivers
Designed to be portable
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
4/19
Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
What is C?
Some languages related to C
• C++• Objective C
• Perl
• TCL
• Java• JavaScript
• PHP
• C#
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
5/19Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Compare C to Other Modern Languages
C++
Objective C C#
Java
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
6/19Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Compare C to Other Modern Languages
C++
Objective C C#
Java
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
7/19Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Compare C to Other Modern Languages
C++
Objective C C#
Java
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
8/19Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Compare C to Other Modern Languages
C++
Objective C C#
Java
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
9/19Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Compare C to Other Modern Languages
C++
Objective C C#
Java
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
10/19Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
What is C?
C is a “Compiled Language”
• Code must be converted to machine code to e• Very speedy execution
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
11/19Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
What is C?
K & R C• First implementation of the language
Documented in 1978
ANSI C• Most common form of the language
Documented in 1983
• Standardized version of the early C language
C99• Next C standard
Documented in 1995
• Adds a few other additional functionalities to the language Ex: Boolean data types, variable length arrays, better hardware usage
C1X• Future C standard
Proposed in 2007
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
12/19
Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Elements of C
Program flow
• External imports Read code file written in C or another language
Use already compiled code
• Functions
Allows for code modularity
Maximizes reusability
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
13/19
Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Elements of C
Data Types• Primitive
Basic data types• Ex: Integer, Floating-point, Character, etc…
• Composite Data types that are made of other data types
• Ex: Structures
• Static Variables that maintain their value during program exec
• Pointers Access to memory locations that data is stored
• Arrays Lists of elements
El f C
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
14/19
Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Elements of C
Processing
• Operators Performs arithmetic or Boolean logical expressio
• Comparisons
Allows different types of expressions to be evalu
dictate process flow
El t f C
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
15/19
Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Elements of C
Control Structures
• Decision Statements Gives the program the ability to make choices ba
logical expressions
• Loops
Traverse through iterations of a processes on a g
dynamic interval
El t f C
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
16/19
Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Elements of C
Data Structures
• Stacks
Method of programming where elements that arrive last are u
• Queues
Method of programming where elements that arrive first are u
• Enumerations (Enums)
A set of integer constants
• Structures (Structs) A set of variable values (Fields) that consist of different types
• Unions
A set of variable values (Members) occupying the same stora
El t f C
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
17/19
Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Elements of C
Memory Allocation
• Allocate Designate dynamic memory
• Reallocate
Reuse previously used memory for a new purpos
• Free
Handing newly available space back over to the
operating system
O W ki E i t
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
18/19
Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Our Working Environment
Technique
• Minimalist
No IDE, simple text editor and compiler
Operating System
• Microsoft Windows
Compiler
• MinGW (Minimalist GNU for Windows)
Windows port of GNU GCC
Text Editor
• Notepad++
http://www.wibit.net/http://www.wibit.net/
-
8/17/2019 Programming in C - 01 - Introduction.pdf
19/19
Copyright © BlueSignet LLC. All rights reserved. For more visit WiBit.Net
Programming
Thanks for
http://www.wibit.net/http://www.wibit.net/