0% found this document useful (0 votes)
30 views

Lecture#6

The document discusses the process of creating, editing, compiling, linking and executing a C program. It explains each step in the process including writing code in an editor, saving files, compiling to generate object files, linking with libraries, and running the executable program.

Uploaded by

Rashad Mahmood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Lecture#6

The document discusses the process of creating, editing, compiling, linking and executing a C program. It explains each step in the process including writing code in an editor, saving files, compiling to generate object files, linking with libraries, and running the executable program.

Uploaded by

Rashad Mahmood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

COMPUTER SCIENCE

12
SUBJECT TEACHER :
RASHAD MAHMOOD
CMA (Managerial) MBA-IT & Business
Cisco Certified Network Administrator
Microsoft Certified System Engineer
Linux Operating System Certified
Comptia Computer Hardware Certified
CHAPTER 8: Getting Started with C

Copyright @ Superior College Kharian RASHAD MAHMOOD ( IT SPECIALIZED


Topics

• Program and Programming languages


• Characteristics of High-Level Programming Languages
• Differentiate between Low-Level and High-Level Languages
• Source Code and Object Code
• Language Processors or Translators
• History of C Language
• Advantages or Characteristics of C Language
• Turbo C++
• Create, Edit , Compile and Execute C Program
• Steps to prepare C Program for Execution

Copyright @ Superior College Kharian RASHAD MAHMOOD ( IT SPECIALIZED


Topics(Cont.)
• .c and .cpp Extensions
• Process of setting te output and source directories
• Basic Structure of C Program
• Preprocessor Directives
• Header Files
• main Function
• C Statements
• Bug and Debug
• Types of Error ( Syntax errors, Logical Errors and Run-Time Errors
• Unstructured and Structured Programming Languages
• Debugging Features of Turbo C++

Copyright @ Superior College Kharian RASHAD MAHMOOD ( IT SPECIALIZED


Q4 (Long) How would you create, edit, compile, link and execute a C
program? Discuss briefly.
Creating and Editing a C program
 Process of Writing C program is known as Editing
 This process includes writing, modifying and deleting program statements
 Part of Turbo C++ IDE that is used to write C programs is called Edit Window
 A new edit windows can be opened by selecting File>New option from menu bar
 Edit has a double lined border
 Cursor blinks in the window
 Position of the cursor indicates the starting
point to write a program
 User can expand window by clicking the arrow
in the upper right corner

Copyright @ Superior College Kharian RASHAD MAHMOOD ( IT SPECIALIZED


Saving a C program
 Process of storing the program on disk
 A program should be saved on disk to be used repeatedly
 C programs are saved with .C extension
 Procedure to Save a C program Using Turbo C++
 Select File>Save. The Save As dialog box will appear
 Default name NONAME00.CPP appears
 Enter the file name
 Enter the path to save file
 Click OK. The program will be saved at specified location

Copyright @ Superior College Kharian RASHAD MAHMOOD ( IT SPECIALIZED


Compile a C program

 Process of converting source program into object program

 Converted program save with .obj extension

 Source program cannot be compiled if it contains any syntax error

 Compiler generates error message to describe the cause of error

 Procedure to Compile C program Using Turbo C++

 Select Compile>Compile

 Program will be translated into object program

 In case of error, compiler will generate error message

Copyright @ Superior College Kharian RASHAD MAHMOOD ( IT SPECIALIZED


Linking a C program
 Linking is process of linking library files with object program
 These files are used to perform different tasks such as input/output
 A library file must be linked with the object file before execution
 Linker is a program that combines the object program with additional library files
 Linker generates error message if the library file does not exist
 A new file is created with .exe extension if the process of linking is successful
 The linker can be started in Turbo C++ by selecting Compiler > Link from the menu bar
Executing a C Program
• Execution is the process of running an executable file
• The C program can be executed afer compiling and linking
• The program must be loaded into memory to execute
• In Turbo C++,
• The program can be loaded in the memory by selecting Run > Run from menu bar or pressing
CTRL+F9.
• The screen flickers for some time when a program is executed.
• The output screen displays the output of the program and disappears.
• The user can display the output screen by selecting Window > User Screen or pressing ALT+F5
Copyright @ Superior College Kharian RASHAD MAHMOOD ( IT SPECIALIZED
Copyright @ Superior College Kharian RASHAD MAHMOOD ( IT SPECIALIZED

You might also like