Chapter 1-1
Chapter 1-1
1. Popularity
2. Convenience of a high level language and speed of a low-level
language
3. Much closer control of a computer's hardware and peripherals
4. Fast code
5. Easy to understand and maintain code / syntax
Real-World Applications of C
• Operating systems
– Unix, MS Windows, Apple Mac, Symbian, Android, etc
• Development of new languages
– C#, Java, Limbo, JavaScript, Perl, PHP, Python, Verilog
• Computation Platforms
– MATLAB, Mathematicia
• Embedded Systems
Real-World Applications of C++
• Games
– Counter Strike, Doom, World of WarCraft, Birthright, Hellfire, Football,
etc
• Web Browsers
– Google chrome, Mozilla Firefox, Internet Explorer, Safari, Opera, etc.
• Office Products
– MS Office, Apache OpenOffice, etc.
• Websites
– Facebook, YouTube, Amazone, Paypal
• Database Systems
– Oracle, MySQL, MS SQL Server, SAP DB, etc.
C/C++ Integrated Development Environment
• Turbo C
• Dev C++
• Eclipse
• Netbeans
• Code::Blocks
• GNAT programming studio
• Visual studio
• CodeLite
• Qt Creator
• Sublime Text
• C++ Builder
• CLion
• MonoDevelop
Turbo C - IDE
Dev-C++ IDE
C Compiler
C Development Envionment
C Execution Envionment
Files used in C Program Development
• After you have typed in the source file for the program, you
should save it on your disk or hard disk. To do this, select the
Save option from the File menu. You can also accomplish the
same effect simply by pressing the Ctrl+s key combination.
• You can save your source file as first.c or first.cpp.
• Its a good idea and programming practice to save your source file
before compiling and running your program.
Compiling and Making an .exe file
• After you have written the source file for your program, you need to
turn it into an executable file. The compiler, which is a part of the
IDE, translate the source code into another file known as (.obj)
Object file, consisting of the machine language.
• The linker then links the entire necessary object files together to
produce a final executable program with the extension (.exe).
• Compiling and linking can be performed together in one step
Exploring the printf ( ) Function
• The printf( ) function uses a unique format for printing constants
and variables. For example
• Output:
My name is Ahmed and I am 20 years old.
Using Format Specifier in printf ( )
void main (void)
{
printf ( “ The letter %c is” , ‘ j ’ ) ;
• Output:
The letter j is pronounced as jay.
Using Format Specifier in printf ( )
• In the above program, there are two different new things to note.
• First we have used %c for the printing of a character which is
surrounded by single quotes where as %s is used for printing a
string which is surrounded by double quotes.
• This is how C Language recognizes the difference between a
character and a string.
Using Format Specifier in printf ( )
• Second thing to note is that even though the output statement is
printed by two separate program lines, it does not consists of
two line of text on the output screen. That is because printf( )
does not automatically prints a new line character at the end of a
line.
• So what to do for inserting a new line in a printf( ) statement?
Learning Resources
Books:
1. Object-Oriented Programming in C++ By Robert Lafore
2. Let Us C By Yashavant P. Kanetkar
Online Resources:
1. https://www.learncpp.com/
2. C Programming For Beginners
Online C Compiler:
https://www.onlinegdb.com/