L2_-_Basic_C_Elements_4 - Lecture Overview CS1010E...

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

View Full Document Right Arrow Icon
S1010E Programming Methodology CS1010E Programming Methodology Basic C Elements The building blocks of C…. Lecture Overview Overview of language C language Run Cycle Basic C Elements arious Statements Various Statements rogramming Styles Programming Styles [ CS1010E AY1112S1 Le cture 2 ] 2 C Language: A brief history C Programming Language riginally designed by ennis Ritchie 1972 Originally designed by Dennis Ritchie in 1972 The 1978 book “The C Programming Language” by Brian Kernighan and Dennis Ritchie Gave the first specification of the language Standardized: in 1990: ANSI C ( ISO C, C89/C90 ) The most widespread version sed in this course Used in this course Evolved: in 1999: C99 3 [ CS1010E AY1112S1 Le cture 2 ] C Language: Characteristics C Programming language is a: Compiled language Program written in C ( source code ) must be compiled into machine code ( executable ) sing Compiler Using C Compiler High Level Programming Language gg g g g Follow a set of rules (grammar) to express algorithm General purpose language Imperative language 4 [ CS1010E AY1112S1 Le cture 2 ]
Background image of page 1

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

View Full DocumentRight Arrow Icon
Run Cycle for Compiled Language Run Cycle: he process of riting, compiling nd The process of writing, compiling and executing a program Writing • Tool: Editor Compiling • Tool: Compiler Executing • Tool: None • Produce: Source Code • Produce: Executable • Produce: Result Compilation Error Runtime Error ogic Error Logic Error 5 [ CS1010E AY1112S1 Le cture 2 ] Environment and Tools in this Course Environment: Cygwin : Emulate Linux (Unix-like) under Windows Tools: Editor: vim , nano , etc (You only need one) Compiler: gcc (GNU C Compiler) Comments and Rationale: Tools look primitive but very flexible and powerful Explicitly show the run cycle step by step 6 [ CS1010E AY1112S1 Le cture 2 ] Run Cycle: Writing a Program Use an editor to write a program following C syntax sing im Using vim editor under cygwin 7 [ CS1010E AY1112S1 Le cture 2 ] Run Cycle: Compiling the Source Code Use a compiler to translate C Source Code into Machine Code Source code with syntax errors will fail to compile Known as Compilation Errors Using gcc compiler under cygwin 8 [ CS1010E AY1112S1 Le cture 2 ]
Background image of page 2
Run Cycle: Executing the Executable The executable can be directly executed May terminate unexpectedly due to errors untime Error Runtime Error May terminate successfully but give the wrong result Logic Error A successful n of the an run of the an executable 9 [ CS1010E AY1112S1 Le cture 2 ] Run Cycle: A reminder Run Cycle happens in the “Implementation” step of the problem solving process You should have designed the before you attempt to write the program Analysis Design l t t i Writing • Tool: Editor Compiling • Tool: Compiler Executing • Tool: None Implementation Testing • Produce: Source Code p • Produce: Executable • Produce: Result 10 [ CS1010E AY1112S1 Le cture 2 ] Your very first C Program The famous “Hello World!” 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
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

L2_-_Basic_C_Elements_4 - Lecture Overview CS1010E...

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

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