SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
C_Programming
First Session
ENG. KEROLES SHENOUDA
1
Why C, and not assembly language?
 While assembly language can provide speed and maximum control of the program, C
provides portability.
 Different processors are programmed using different Assembly languages and having to
choose and learn only one of them is too arbitrary. In fact, one of the main strengths of C is
that it combines universality and portability across various computer architectures while
retaining most of the control of the hardware provided by assembly language.
 For example, C programs can be compiled and run on the HP 50g calculator (ARM
processor), the TI-89 calculator (68000 processor), Palm OS Cobalt smartphones (ARM
processor), the original iMac (PowerPC), the Arduino (Atmel AVR), and the Intel iMac (Intel
Core 2 Duo). Each of these devices has its own assembly language that is completely
incompatible with the assembly language of any other.
 Assembly, while extremely powerful, is simply too difficult to program large applications and
hard to read or interpret in a logical way. C is a compiled language, which creates fast and
efficient executable files. It is also a small "what you see is all you get" language: a C
statement corresponds to at most a handful of assembly statements, everything else is
provided by library functions.
2
Why C, and not another language?
 The primary design of C is to produce portable code while maintaining
performance and minimizing footprint (CPU time, memory, disk I/O, etc.). This
is useful for operating systems, embedded systems or other programs where
performance matters a lot ("high-level" interface would affect performance)
 One powerful reason is memory allocation. Unlike most programming
languages, C allows the programmer to write directly to memory.
 C gives control over the memory layout of data structures
 Moreover dynamic memory allocation is under the control of the programmer
(which also means that memory deallocation has to be done by the
programmer).
 While Perl, PHP, Python and Ruby may be powerful and support many features
not provided by default in C
3
Compilation Process 4
C - Environment Setup 5
IDE + Compiler
Install Eclipse C/C++ Development Tool (CDT)
Java Downloads for All Operating Systems
1. Install MinGW GCC
Minimalist GNU for Windows
https://sourceforge.net/projects/mingw/file
s/
2. Cygwin GCC
https://www.cygwin.com/setup-x86.exe
Cygwin is:
a large collection of GNU and Open Source tools
which provide functionality similar to a Linux
distribution on Windows.
a DLL (cygwin1.dll) which provides substantial
POSIX API functionality.
Install MinGW GCC 6
Press Apply to all
Install MinGW GCC
Minimalist GNU for Windows
https://sourceforge.net/projects/mingw/files/
Install MinGW GCC 7
Wait until downloading Complete
Install MinGW GCC 8
Install MinGW GCC 9
En you can see all the basic packets
became green
Install MinGW GCC 10
Then you can see the
gcc and gdb and other
binary utilities installed
(Native Toolchain )
Eclipse C/C++ (CDT) 11
 Install Eclipse C/C++ Development Tool (CDT)
 Java Downloads for All Operating Systems
Write first C Program
 Open Eclipse
 Chose an empty Directory For eclipse workspace
12
Write first C Program 13
Write first C Program 14
Write first C Program 15
Write first C Program 16
Write first C Program (Build the
Application)
17
Write first C Program (Run the
Application)
18
After Press Run,
Then you will see the
Printf message appearing
On the Console
Write first C Program (Debug the
Application)
19
Write first C Program (Debug the
Application)
20
Stopped
on the
Breakpoint
Write first C Program (Debug the
Application)
21
GCC Compilation Process
 Pre-processing: via the GNU C Preprocessor (cpp.exe), which includes the
headers (#include) and expands the macros (#define).
 cpp hello.c > hello.i
The resultant intermediate file "hello.i" contains the expanded source code.
 Compilation: The compiler compiles the pre-processed source code into
assembly code for a specific processor.
 gcc -S hello.i
The -S option specifies to produce assembly code, instead of object code. The
resultant assembly file is "hello.s".
 Assembly: The assembler (as.exe) converts the assembly code into machine
code in the object file "hello.o".
 as -o hello.o hello.s
 Linker: Finally, the linker (ld.exe) links the object code with the library code
to produce an executable file "hello.exe".
 ld -o hello.exe hello.o ...libraries...
22
GCC Compilation Process LAB 1
on Ubuntu
23
GCC Compilation Process LAB 1
on Ubuntu
24
GCC Compilation Process LAB 1
on Ubuntu
25
GCC Compilation Process LAB 1
on Ubuntu
26
GCC Compilation Process LAB 1
on Ubuntu
27
Compilation Process 28
First C Program “Hello Program” 29
30
31
Chapter 1:
Introduction
HTTPS://DRIVE.GOOGLE.COM/FILE/D/0B7KUSGPVTWFLAEZDWLZEZM0XS0U/VIEW
32
C Programming Data Types 33
Refrences
 GCC and Make Compiling, Linking and Building C/C++ Applications
 C Programming/Why learn C?
 Getting Started with C/C++ Development Tools for NI Linux Real-Time, Eclipse
Edition
34

Mais conteúdo relacionado

Mais procurados

Embedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontrollerEmbedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontrollerGaurav Verma
 
Embedded System Practical manual (1)
Embedded System Practical manual (1)Embedded System Practical manual (1)
Embedded System Practical manual (1)Niraj Bharambe
 
Writing c code for the 8051
Writing c code for the 8051Writing c code for the 8051
Writing c code for the 8051Quản Minh Tú
 
Loader and Its types
Loader and Its typesLoader and Its types
Loader and Its typesParth Dodiya
 
Embedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterEmbedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterHossam Hassan
 
Introduction to Assembly Language Programming
Introduction to Assembly Language ProgrammingIntroduction to Assembly Language Programming
Introduction to Assembly Language ProgrammingRahul P
 
Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic conceptsAbdul Khan
 

Mais procurados (19)

C programming session10
C programming  session10C programming  session10
C programming session10
 
Embedded C - Lecture 1
Embedded C - Lecture 1Embedded C - Lecture 1
Embedded C - Lecture 1
 
Embedded c
Embedded cEmbedded c
Embedded c
 
Embedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontrollerEmbedded C programming based on 8051 microcontroller
Embedded C programming based on 8051 microcontroller
 
Embedded C programming session10
Embedded C programming  session10Embedded C programming  session10
Embedded C programming session10
 
C programming session6
C programming  session6C programming  session6
C programming session6
 
Embedded System Practical manual (1)
Embedded System Practical manual (1)Embedded System Practical manual (1)
Embedded System Practical manual (1)
 
Writing c code for the 8051
Writing c code for the 8051Writing c code for the 8051
Writing c code for the 8051
 
C basics
C   basicsC   basics
C basics
 
Machine language
Machine languageMachine language
Machine language
 
Loader and Its types
Loader and Its typesLoader and Its types
Loader and Its types
 
C programming part2
C programming part2C programming part2
C programming part2
 
Embedded C workshop
Embedded C workshopEmbedded C workshop
Embedded C workshop
 
Embedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterEmbedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals master
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Pt 51 ver-1.3_user_manual
Pt 51 ver-1.3_user_manualPt 51 ver-1.3_user_manual
Pt 51 ver-1.3_user_manual
 
Introduction to Assembly Language Programming
Introduction to Assembly Language ProgrammingIntroduction to Assembly Language Programming
Introduction to Assembly Language Programming
 
Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic concepts
 
Embedded concepts
Embedded conceptsEmbedded concepts
Embedded concepts
 

Destaque (20)

C programming session3
C programming  session3C programming  session3
C programming session3
 
C programming part4
C programming part4C programming part4
C programming part4
 
Automative basics v3
Automative basics v3Automative basics v3
Automative basics v3
 
Microcontroller part 1
Microcontroller part 1Microcontroller part 1
Microcontroller part 1
 
K vector embedded_linux_workshop
K vector embedded_linux_workshopK vector embedded_linux_workshop
K vector embedded_linux_workshop
 
C programming session7
C programming  session7C programming  session7
C programming session7
 
Microcontroller part 4
Microcontroller part 4Microcontroller part 4
Microcontroller part 4
 
Microcontroller part 3
Microcontroller part 3Microcontroller part 3
Microcontroller part 3
 
C programming session8
C programming  session8C programming  session8
C programming session8
 
Microcontroller part 2
Microcontroller part 2Microcontroller part 2
Microcontroller part 2
 
Microcontroller part 5
Microcontroller part 5Microcontroller part 5
Microcontroller part 5
 
C programming part2
C programming part2C programming part2
C programming part2
 
C programming part4
C programming part4C programming part4
C programming part4
 
C programming session5
C programming  session5C programming  session5
C programming session5
 
Microcontroller part 1
Microcontroller part 1Microcontroller part 1
Microcontroller part 1
 
Microcontroller part 4
Microcontroller part 4Microcontroller part 4
Microcontroller part 4
 
Microcontroller part 8_v1
Microcontroller part 8_v1Microcontroller part 8_v1
Microcontroller part 8_v1
 
Microcontroller part 3
Microcontroller part 3Microcontroller part 3
Microcontroller part 3
 
Microcontroller part 6_v1
Microcontroller part 6_v1Microcontroller part 6_v1
Microcontroller part 6_v1
 
Microcontroller part 2
Microcontroller part 2Microcontroller part 2
Microcontroller part 2
 

Semelhante a C Programming Fundamentals - Why C, Compilation Process, Hello World

COM1407: Introduction to C Programming
COM1407: Introduction to C Programming COM1407: Introduction to C Programming
COM1407: Introduction to C Programming Hemantha Kulathilake
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c languagefarishah
 
Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7Shipra Swati
 
Btech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c languageBtech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c languageRai University
 
Bsc cs i pic u-1 introduction to c language
Bsc cs i pic u-1 introduction to c languageBsc cs i pic u-1 introduction to c language
Bsc cs i pic u-1 introduction to c languageRai University
 
introduction to c language
 introduction to c language introduction to c language
introduction to c languageRai University
 
Mca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c languageMca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c languageRai University
 
Diploma ii cfpc u-1 introduction to c language
Diploma ii  cfpc u-1 introduction to c languageDiploma ii  cfpc u-1 introduction to c language
Diploma ii cfpc u-1 introduction to c languageRai University
 
Source vs object code
Source vs object codeSource vs object code
Source vs object codeSana Ullah
 
Introduction
IntroductionIntroduction
IntroductionKamran
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docMayurWagh46
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxNEHARAJPUT239591
 

Semelhante a C Programming Fundamentals - Why C, Compilation Process, Hello World (20)

COM1407: Introduction to C Programming
COM1407: Introduction to C Programming COM1407: Introduction to C Programming
COM1407: Introduction to C Programming
 
Introduction to c language
Introduction to c language Introduction to c language
Introduction to c language
 
Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c language
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7Fundamental of Information Technology - UNIT 7
Fundamental of Information Technology - UNIT 7
 
Btech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c languageBtech i pic u-1 introduction to c language
Btech i pic u-1 introduction to c language
 
Bsc cs i pic u-1 introduction to c language
Bsc cs i pic u-1 introduction to c languageBsc cs i pic u-1 introduction to c language
Bsc cs i pic u-1 introduction to c language
 
C
CC
C
 
introduction to c language
 introduction to c language introduction to c language
introduction to c language
 
Mca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c languageMca i pic u-1 introduction to c language
Mca i pic u-1 introduction to c language
 
Diploma ii cfpc u-1 introduction to c language
Diploma ii  cfpc u-1 introduction to c languageDiploma ii  cfpc u-1 introduction to c language
Diploma ii cfpc u-1 introduction to c language
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
C in7-days
C in7-daysC in7-days
C in7-days
 
C in7-days
C in7-daysC in7-days
C in7-days
 
Source vs object code
Source vs object codeSource vs object code
Source vs object code
 
Introduction
IntroductionIntroduction
Introduction
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
 
Ctutor ashu
Ctutor ashuCtutor ashu
Ctutor ashu
 
C programming part1
C programming part1C programming part1
C programming part1
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptx
 

Mais de Keroles karam khalil

Mais de Keroles karam khalil (20)

C basics quiz part 1_solution
C basics quiz part 1_solutionC basics quiz part 1_solution
C basics quiz part 1_solution
 
Autosar Basics hand book_v1
Autosar Basics  hand book_v1Autosar Basics  hand book_v1
Autosar Basics hand book_v1
 
Automotive embedded systems part6 v2
Automotive embedded systems part6 v2Automotive embedded systems part6 v2
Automotive embedded systems part6 v2
 
Automotive embedded systems part5 v2
Automotive embedded systems part5 v2Automotive embedded systems part5 v2
Automotive embedded systems part5 v2
 
Automotive embedded systems part7 v1
Automotive embedded systems part7 v1Automotive embedded systems part7 v1
Automotive embedded systems part7 v1
 
Automotive embedded systems part6 v1
Automotive embedded systems part6 v1Automotive embedded systems part6 v1
Automotive embedded systems part6 v1
 
Automotive embedded systems part5 v1
Automotive embedded systems part5 v1Automotive embedded systems part5 v1
Automotive embedded systems part5 v1
 
Automotive embedded systems part4 v1
Automotive embedded systems part4 v1Automotive embedded systems part4 v1
Automotive embedded systems part4 v1
 
Automotive embedded systems part3 v1
Automotive embedded systems part3 v1Automotive embedded systems part3 v1
Automotive embedded systems part3 v1
 
Automotive embedded systems part2 v1
Automotive embedded systems part2 v1Automotive embedded systems part2 v1
Automotive embedded systems part2 v1
 
Automotive embedded systems part1 v1
Automotive embedded systems part1 v1Automotive embedded systems part1 v1
Automotive embedded systems part1 v1
 
Automotive embedded systems part8 v1
Automotive embedded systems part8 v1Automotive embedded systems part8 v1
Automotive embedded systems part8 v1
 
Quiz 9
Quiz 9Quiz 9
Quiz 9
 
Quiz 10
Quiz 10Quiz 10
Quiz 10
 
Homework 6
Homework 6Homework 6
Homework 6
 
Homework 5 solution
Homework 5 solutionHomework 5 solution
Homework 5 solution
 
C programming session8
C programming  session8C programming  session8
C programming session8
 
Notes part7
Notes part7Notes part7
Notes part7
 
Homework 5
Homework 5Homework 5
Homework 5
 
C programming session7
C programming  session7C programming  session7
C programming session7
 

Último

11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdfsahilsajad201
 
Industrial Applications of Centrifugal Compressors
Industrial Applications of Centrifugal CompressorsIndustrial Applications of Centrifugal Compressors
Industrial Applications of Centrifugal CompressorsAlirezaBagherian3
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewsandhya757531
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESkarthi keyan
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming languageSmritiSharma901052
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.elesangwon
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfBalamuruganV28
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfManish Kumar
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodManicka Mamallan Andavar
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSneha Padhiar
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Sumanth A
 

Último (20)

11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdf
 
Industrial Applications of Centrifugal Compressors
Industrial Applications of Centrifugal CompressorsIndustrial Applications of Centrifugal Compressors
Industrial Applications of Centrifugal Compressors
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overview
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming language
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdf
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Levelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument methodLevelling - Rise and fall - Height of instrument method
Levelling - Rise and fall - Height of instrument method
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
 

C Programming Fundamentals - Why C, Compilation Process, Hello World

  • 2. Why C, and not assembly language?  While assembly language can provide speed and maximum control of the program, C provides portability.  Different processors are programmed using different Assembly languages and having to choose and learn only one of them is too arbitrary. In fact, one of the main strengths of C is that it combines universality and portability across various computer architectures while retaining most of the control of the hardware provided by assembly language.  For example, C programs can be compiled and run on the HP 50g calculator (ARM processor), the TI-89 calculator (68000 processor), Palm OS Cobalt smartphones (ARM processor), the original iMac (PowerPC), the Arduino (Atmel AVR), and the Intel iMac (Intel Core 2 Duo). Each of these devices has its own assembly language that is completely incompatible with the assembly language of any other.  Assembly, while extremely powerful, is simply too difficult to program large applications and hard to read or interpret in a logical way. C is a compiled language, which creates fast and efficient executable files. It is also a small "what you see is all you get" language: a C statement corresponds to at most a handful of assembly statements, everything else is provided by library functions. 2
  • 3. Why C, and not another language?  The primary design of C is to produce portable code while maintaining performance and minimizing footprint (CPU time, memory, disk I/O, etc.). This is useful for operating systems, embedded systems or other programs where performance matters a lot ("high-level" interface would affect performance)  One powerful reason is memory allocation. Unlike most programming languages, C allows the programmer to write directly to memory.  C gives control over the memory layout of data structures  Moreover dynamic memory allocation is under the control of the programmer (which also means that memory deallocation has to be done by the programmer).  While Perl, PHP, Python and Ruby may be powerful and support many features not provided by default in C 3
  • 5. C - Environment Setup 5 IDE + Compiler Install Eclipse C/C++ Development Tool (CDT) Java Downloads for All Operating Systems 1. Install MinGW GCC Minimalist GNU for Windows https://sourceforge.net/projects/mingw/file s/ 2. Cygwin GCC https://www.cygwin.com/setup-x86.exe Cygwin is: a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows. a DLL (cygwin1.dll) which provides substantial POSIX API functionality.
  • 6. Install MinGW GCC 6 Press Apply to all Install MinGW GCC Minimalist GNU for Windows https://sourceforge.net/projects/mingw/files/
  • 7. Install MinGW GCC 7 Wait until downloading Complete
  • 9. Install MinGW GCC 9 En you can see all the basic packets became green
  • 10. Install MinGW GCC 10 Then you can see the gcc and gdb and other binary utilities installed (Native Toolchain )
  • 11. Eclipse C/C++ (CDT) 11  Install Eclipse C/C++ Development Tool (CDT)  Java Downloads for All Operating Systems
  • 12. Write first C Program  Open Eclipse  Chose an empty Directory For eclipse workspace 12
  • 13. Write first C Program 13
  • 14. Write first C Program 14
  • 15. Write first C Program 15
  • 16. Write first C Program 16
  • 17. Write first C Program (Build the Application) 17
  • 18. Write first C Program (Run the Application) 18 After Press Run, Then you will see the Printf message appearing On the Console
  • 19. Write first C Program (Debug the Application) 19
  • 20. Write first C Program (Debug the Application) 20 Stopped on the Breakpoint
  • 21. Write first C Program (Debug the Application) 21
  • 22. GCC Compilation Process  Pre-processing: via the GNU C Preprocessor (cpp.exe), which includes the headers (#include) and expands the macros (#define).  cpp hello.c > hello.i The resultant intermediate file "hello.i" contains the expanded source code.  Compilation: The compiler compiles the pre-processed source code into assembly code for a specific processor.  gcc -S hello.i The -S option specifies to produce assembly code, instead of object code. The resultant assembly file is "hello.s".  Assembly: The assembler (as.exe) converts the assembly code into machine code in the object file "hello.o".  as -o hello.o hello.s  Linker: Finally, the linker (ld.exe) links the object code with the library code to produce an executable file "hello.exe".  ld -o hello.exe hello.o ...libraries... 22
  • 23. GCC Compilation Process LAB 1 on Ubuntu 23
  • 24. GCC Compilation Process LAB 1 on Ubuntu 24
  • 25. GCC Compilation Process LAB 1 on Ubuntu 25
  • 26. GCC Compilation Process LAB 1 on Ubuntu 26
  • 27. GCC Compilation Process LAB 1 on Ubuntu 27
  • 29. First C Program “Hello Program” 29
  • 30. 30
  • 31. 31
  • 33. C Programming Data Types 33
  • 34. Refrences  GCC and Make Compiling, Linking and Building C/C++ Applications  C Programming/Why learn C?  Getting Started with C/C++ Development Tools for NI Linux Real-Time, Eclipse Edition 34