The C Language 1/31/14.

Slides:



Advertisements
Similar presentations
Chapter 2: Basic Elements of C++
Advertisements

Lecture 2 Introduction to C Programming
Introduction to C Programming
 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
1 CS 161 Introduction to Programming and Problem Solving Chapter 9 C++ Program Components Herbert G. Mayer, PSU Status 10/20/2014.
Introduction to C Programming
Your First C++ Program Aug 27, /27/08 CS 150 Introduction to Computer Science I C++  Based on the C programming language  One of today’s most.
Unix Continuum of Tools Do something once: use the command line Do something many times: –Use an alias –Use a shell script Do something that is complex.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
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?
1 ICS103 Programming in C Lecture 2: Introduction to C (1)
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
Guide To UNIX Using Linux Third Edition
Introduction to C Programming
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
Basic Elements of C++ Chapter 2.
C Programming. Chapter – 1 Introduction Study Book for one month – 25% Learning rate Use Compiler for one month – 60%
Introduction to C Language
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.
A First Book of ANSI C Fourth Edition
Chapter 3 Getting Started with C++
Hello World 2 What does all that mean?.
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
Chapter 2 Overview of C Part I J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National Taipei University.
 Input and Output Functions Input and Output Functions  OperatorsOperators Arithmetic Operators Assignment Operators Relational Operators Logical Operators.
Programming With C.
/* Documentations */ Pre process / Linking statements Global declarations; main( ) { Local Declarations; Program statements / Executable statements; }
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
Introduction to C Programming Angela Chih-Wei Tang ( 唐 之 瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan 2010 Fall.
Structure of a C program Preprocessor directive (header file) Program statement } Preprocessor directive Global variable declaration Comments Local variable.
Basic Program Construction
1 A simple C++ program // ======================================================= // File:helloworld.cpp // Author:Vana Doufexi // Date:1/4/2006 // Description:Displays.
Khalid Rasheed Shaikh Computer Programming Theory 1.
DOCUMENTATION SECTION GLOBAL DECLARATION SECTION
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
Introduction Chapter 1 1/22/16. Check zyBooks Completion Click on the boxes for each section.
Computer Programming A simple example /* HelloWorld: A simple C program */ #include int main (void) { printf (“Hello world!\n”); return.
CSE1222: Lecture 1The Ohio State University1. Computing Basics  Computers CPU, Memory & Input/Output (IO)  Program Sequence of instructions for the.
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
A.Abhari CPS1251 Topic 2: C Overview C Language Elements Variable Declaration and Data Types Statement Execution C Program Layout Formatting Output Interactive.
1 Structure of Simple C++ Program Chapter 1 09/09/13.
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.
BIL 104E Introduction to Scientific and Engineering Computing Lecture 1.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
2.1 The Part of a C++ Program. The Parts of a C++ Program // sample C++ program #include using namespace std; int main() { cout
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
Chapter Topics The Basics of a C++ Program Data Types
CSC201: Computer Programming
Input and Output: I/O Finish reading chapters 1 and 2 of the text
INC 161 , CPE 100 Computer Programming
Chapter 2 - Introduction to C Programming
Basic Elements of C++.
Introduction to C Language
Chapter 2 - Introduction to C Programming
Basic Elements of C++ Chapter 2.
Hello World 2 What does all that mean?.
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Chapter 2 - Introduction to C Programming
Introduction to C Topics Compilation Using the gcc Compiler
Chapter 2 - Introduction to C Programming
Your first C and C++ programs
Introduction to C Topics Compilation Using the gcc Compiler
Chapter 2 - Introduction to C Programming
C Programming Language
Introduction to Programming - 1
Introduction to C Topics Compilation Using the gcc Compiler
Presentation transcript:

The C Language 1/31/14

Quiz Take quiz 1 on Blackboard Over vim, linux, and Chapter 1.

Assignment On your own, answer the following questions. p.17 #1 Edit, compile and execute this program. p. 57 #3 submit jjarboe cs115 2 Read pp. 65-94 and Chapter 3 for next week.

C is a Functional Language Example program ch2/retail.c Existing functions serve as basis for new functions. printf and library function used to create main

main Function Exactly one main() in a program Tells other functions when to execute Calls them int main() -- Function Header { -- Body inside { } -- Executable Statements }

Comments /* Comment */ Ignored by compiler Documents program

Preprocessor Command #include <stdio.h> Inserts code at that point Inserts the code before the compile Provides interface with printf and scanf functions

printf Sends argument to monitor screen printf(“Hello, Steve\n”);

Programming Style What is wrong with style2.c? No Syntax Errors

Programming Style Indentation Comments Meaningful identifiers Indent statements between { } Comments Name, Date, Description of program Meaningful identifiers “counties” instead of “x”

Questions Give an example of a preprocessor command. What are two rules for good programming style?

Next Data Types and Arithmetic Operations