lec19 - ComputerProgrammingITAC162. Todays Agenda...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Computer Programming I TA C162 . 22/02/07 Today’s Agenda Introduction to C language Structure of a C program Character Set Key words and Identifiers Constants Variables Data Types
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Computer Programming I TA C162 . 22/02/07 Structure of a C Language Program /* Program to compute …………………………. */ #include<stdio.h> /*Library files inclusion */ /* Global variable declaration …………………. */ int main() { /* local variable declarations */ /* initialization */ /* statements */ return(0); }
Background image of page 2
3 Computer Programming I TA C162 . 22/02/07 Structure of a C Program   Every C program consists of one or more modules called  functions.  One of the functions must be called  main. Execution will always begin by  main.  Each compound statement is enclosed within a  pair of braces   Statement1;   Statement2;    ……… }  Each statement must end with a semicolon (;)  Anything within /* */ treated as comments  Comments may appear anywhere within program
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Computer Programming I TA C162 . 22/02/07 Example: A simple C program #include<stdio.h> /*Library files inclusion */ /* Global variable declaration …………………. */ int main() { int num1,num2,sum; /* Variable declaration*/ num1 = 5; /* Initialization */ num2 = 10; sum = num1 + num2; /* Expression */ printf(“Sum of numbers = %d”,sum); /*output*/ return(0); }
Background image of page 4
5 Computer Programming I TA C162 . 22/02/07 About C  General purpose structured programming language  Characterized by the ability to write very concise source    program  Comparatively small instruction set  Programs are highly portable
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 18

lec19 - ComputerProgrammingITAC162. Todays Agenda...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online