{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

2 - 1 ICS103 Programming in C Lecture 2 Introduction to C(1...

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 ICS103 Programming in C Lecture 2: Introduction to C (1) 2 Outline • Overview of C History & Philosophy Why C? What’s Missing? • General form of a C program • C Language Elements Preprocessor Directives Comments The “main” function Variable Declarations and Data Types Executable Statements Reserved Words Identifiers 3 History & Philosophy • C is developed in 1972 by Dennis Ritchie at the AT&T Bell Laboratories for use with the Unix. • The most commonly used programming language for writing system software. • Machine independent: by minimal change in source code, can be compiled in a wide variety of platform and operating system. 4 Why C? • Many, many companies/research projects do all their programming in C. • Looks good on your resume. • Small, compact code. • Produces optimized programs that run faster. • Low-level access to computer memory via machine addresses and pointers. • Low level (BitWise) programming readily available. • Can be compiled on a variety of computers. 5 What’s Missing? • Poor error detection which can make it difficult to use for the beginner No automatic garbage collection. No bounds checking of arrays and allocated memory segments. No exception handling. • No native support for multithreading and networking, though these facilities are provided by popular libraries • No standard libraries for graphics and several other application programming needs 6 A Simple, Example C Program /* helloworld.c */ #include <stdio.h> int main(void) { printf("Hello World!\n"); return(0); } • Every C program has a main function. • printf is also the name of a function • This program can use the printf function, because of the line #include <stdio.h> in the source code. 7 General Form of a C program • Executable statements are translated into machine language...
View Full Document

{[ snackBarMessage ]}

Page1 / 18

2 - 1 ICS103 Programming in C Lecture 2 Introduction to C(1...

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

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