DOCUMENTATION SECTION GLOBAL DECLARATION SECTION

Slides:



Advertisements
Similar presentations
Introduction to C++ An object-oriented language Unit - 01.
Advertisements

An Introduction to Programming By :- Vishal Hirani B.Tech II year (CSE)
Dale Roberts Introduction to Java - First Program Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and.
Lecture 2 Introduction to C Programming
Introduction to C Programming
1 CS 161 Introduction to Programming and Problem Solving Chapter 9 C++ Program Components Herbert G. Mayer, PSU Status 10/20/2014.
Structure of a C program
C Programming Language 4 Developed in 1972 by Dennis Ritchie at AT&T Bell Laboratories 4 Used to rewrite the UNIX operating system 4 Widely used on UNIX.
Chapter3: Language Translation issues
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Simplest program and Data Output Sen Zhang. The simplest program looks like a single person company! void main() { // this starts a comment line // here.
1 Modularity In “C”. 2 General Syntax data_type function_Name (parameter list) { … return expression; // return output } Body of the function is a compound.
CS 201 Functions Debzani Deb.
The C Language 1/31/14.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
C OMPUTER P ROGRAMMING 1 Introduction to the C Language.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Using C Programming Language.  The programs that run on a computer are referred to as software.  You’ll learn key programming methodology that are enhancing.
Chapter 6: Function. Scope of Variable A scope is a region of the program and broadly speaking there are three places, where variables can be declared:
By: Mr. Baha Hanene Chapter 3. Learning Outcomes We will cover the learning outcome 02 in this chapter i.e. Use basic data-types and input / output in.
Welcome In The World Of ‘C’.  TEXT BOOK: Programming in ANCI ‘C By: E Balagurusamy. TMH  Reference Books: 1) The ‘C Programming Language By: Kernighan.
Chapter 3 Getting Started with C++
Hello World 2 What does all that mean?.
Introduction of C++ language. C++ Predecessors Early high level languages or programming languages were written to address a particular kind of computing.
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
H.Melikian Introduction on C C is a high-level programming language that forms the basis to other programming languages such as C++, Perl and Java. It.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
/* Documentations */ Pre process / Linking statements Global declarations; main( ) { Local Declarations; Program statements / Executable statements; }
COMPUTER PROGRAMMING. A Typical C++ Environment Phases of C++ Programs: 1- Edit 2- Preprocess 3- Compile 4- Link 5- Load 6- Execute Loader Primary Memory.
CHAPTER 2 PART #1 C++ PROGRAM STRUCTURE 1 st semester H 1 King Saud University College of Applied studies and Community Service Csc 1101 By:
Computer Programming I Hour 2 - Writing Your First C Program.
Structure of a C program Preprocessor directive (header file) Program statement } Preprocessor directive Global variable declaration Comments Local variable.
1 ICS103 Programming in C Lecture 7: Introduction to Functions.
Basic Program Construction
C programming language was developed in the seventies by a group of at the Bell Telephone lab. The C language was the outline of two earlier languages.
1 A simple C++ program // ======================================================= // File:helloworld.cpp // Author:Vana Doufexi // Date:1/4/2006 // Description:Displays.
Chapter 2 part #1 C++ Program Structure
Introduction to C CMSC 104, Section 4 Richard Chang 1.
CSCI 3133 Programming with C Instructor: Bindra Shrestha University of Houston – Clear Lake.
Functions  A Function is a self contained block of one or more statements or a sub program which is designed for a particular task is called functions.
Computer Programming A simple example /* HelloWorld: A simple C program */ #include int main (void) { printf (“Hello world!\n”); return.
An overview of C Language. Overview of C C language is a general purpose and structured programming language developed by 'Dennis Ritchie' at AT &T's.
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
Functions, Part 1 of 3 Topics  Using Predefined Functions  Programmer-Defined Functions  Using Input Parameters  Function Header Comments Reading 
Programming Fundamentals Enumerations and Functions.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
STRUCTURED PROGRAMMING Complete C++ Program. Content 2  Main Function  Preprocessor directives  User comments  Escape characters  cout statement.
Introduction to C Topics Compilation Using the gcc Compiler
CSC201: Computer Programming
C Programming Hardik H. Maheta.
Chapter 2, Part I Introduction to C Programming
Chapter 2 part #1 C++ Program Structure
History of ‘C’ Root of the morden language is ALGOL It’s first
Programming Fundamentals Lecture #7 Functions
2011/11/20: Lecture 15 CMSC 104, Section 4 Richard Chang
Welcome In The World Of ‘C’.  TEXT BOOK: Programming in ANSI ‘C By: E Balagurusamy. TMH  Reference Books: 1) The ‘C Programming Language By: Kernighan.
Visit for more Learning Resources
Hello World 2 What does all that mean?.
Chapter 4 void Functions
Functions, Part 1 of 3 Topics Using Predefined Functions
Comments, Prototypes, Headers & Multiple Source Files
Programming Fundamentals Lecture #3 Overview of Computer Programming
Functions, Part 1 of 3 Topics Using Predefined Functions
C Programming Language
Functions, Part 1 of 3 Topics Using Predefined Functions
UNIT 1 First programs.
CPS125.
Chapter 2 part #1 C++ Program Structure
Presentation transcript:

DOCUMENTATION SECTION GLOBAL DECLARATION SECTION Structure of C program DOCUMENTATION SECTION PREPROCESSOR SECTION DEFINITION SECTION GLOBAL DECLARATION SECTION main() { Declaration part; Executable Part; } sub program section Body of the subprogram;

Documentation Section Preprocessor Section Global Declaration Section It contains the comment lines. Preprocessor Section It is used to link library files. Global Declaration Section The Global declaration section comes at the beginning of the program and they are visible to all parts of the program. Declaration Section It describes the data to be used within the function. Executable Part It contains the valid statements.

C Programs C program may have many functions. One and only one of the functions MUST BE named main. main is the starting point for the program. main and other functions in a program are divided into two sections, declaration section and statement section.

Preprocessor Directives Special instructions to the preprocessor that tells how to prepare the program for compilation E.g: include : tells the processor to include information from selected libraries known as header files e.g. <stdio.h>

Comments (Program documentation) The compiler simply ignores comments when it translates the program into executable code. To identify a comments, C uses opening /* and closing */ comment tokens.

Comments (Cont) Comments can appear anywhere in a program. Comments are also found wherever it is necessary to explain a point about a code. Comments cannot be nested in C i.e. you cannot have comments inside comments.

C program /* Example program in C*/ Comments # include <stdio.h> Preprocessor Section Global Declaration void main () { Local declaration printf (“Hello World! \n”); Statements } Output : Hello World