Department of Electronic & Electrical Engineering Introduction to C - The Development cycle. Why C? The development cycle. Using Visual Studio ? A simple.

Slides:



Advertisements
Similar presentations
An Introduction to Programming By :- Vishal Hirani B.Tech II year (CSE)
Advertisements

Compilation and Debugging 101. Compilation in C/C++ hello.c Preprocessor Compiler stdio.h tmpXQ.i (C code) hello.o (object file)
Overview of programming in C C is a fast, efficient, flexible programming language Paradigm: C is procedural (like Fortran, Pascal), not object oriented.
C Programming Day 1 based upon Practical C Programming by Steve Oualline CS550 Operating Systems.
COSC 120 Computer Programming
Introduction to C Programming CE Lecture 1 Introduction to C.
1 CSSE 332 Course Introduction. Roll Call and Introductions Name (nickname) Name (nickname) Hometown Hometown Local Residence Local Residence Major Major.
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.
CS1061 C Programming Lecture 2: A Few Simple Programs A. O’Riordan, 2004.
Guide To UNIX Using Linux Third Edition
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.
1 Chapter Two Introduction to the Programming Language C.
Introduction to C Topics Compilation Using the gcc Compiler
Introduction to C. A Brief History Created by Dennis Ritchie at AT&T Labs in 1972 Originally created to design and support the Unix operating system.
Computer Science 210 Computer Organization Introduction to C.
Introduction to C Programming. A Brief History u Created by Dennis Ritchie at AT&T Labs in 1972 u Originally created to design and support the Unix operating.
Programming Design Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
Gator Engineering 1 Chapter 2 C Fundamentals Copyright © 2008 W. W. Norton & Company. All rights reserved.
Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice:
Creating your first C++ program
Programming With C.
1 計算機程式設計 Introduction to Computer Programming Lecture01: Introduction and Hello World 9/10/2012 Slides modified from Yin Lou, Cornell CS2022: Introduction.
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.
1 Programming in C Hello World! Soon I will control the world! Soon I will control the world!
Computer Programming I Hour 2 - Writing Your First C Program.
Geog Basic Skills in Scientific Programming Syllabus, Introduction, Fundamentals of IDL Syntax.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Introduction to C CMSC 104, Section 4 Richard Chang 1.
Introduction to C 2008/09/29: Lecture 7 CMSC 104, Section 0101 John Y. Park 1.
CMSC 104, Lecture 111 Introduction to C Topics l Compilation l Using the gcc Compiler l The Anatomy of a C Program l 104 C Programming Standards and Indentation.
Anatomy of the simplest C Program Sen Zhang SUNY Oneonta Oneonta, NEW YORK © 2004
CPS120: Introduction to Computer Science Compiling a C++ Program From The Command Line.
Minimal standard C program int main(void) { return 0 ; }
CS 251 C Programming for Engineers Spring 2016 Instructor: Dick Lang.
Announcements Assignment 1 due Wednesday at 11:59PM Quiz 1 on Thursday 1.
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
C is a high level language (HLL)
Introduction to C Programming
C Programming Lecture 3 : C Introduction 1 Lecture notes : courtesy of Woo Kyun and Chang Byung-Mo.
L071 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program Reading Sections
Chapter 1 slides1 What is C? A high-level language that is extremely useful for engineering computations. A computer language that has endured for almost.
CSE-102: PROGRAMMING FUNDAMENTALS LECTURE 3: BASICS OF C Course Instructor: Syed Monowar Hossain 1.
1 CS 192 Lecture 4 Winter 2003 December 8-9, 2003 Dr. Shafay Shamail.
KYC - Know your compiler Introduction to GCC
Introduction to C Topics Compilation Using the gcc Compiler
Lecture 1b- Introduction
UMBC CMSC 104 – Section 01, Fall 2016
Computer Science 210 Computer Organization
Chapter 5- Assembling , Linking, and Executing Programs
Introduction to C Language
C Programming Hardik H. Maheta.
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Introduction to C Topics Compilation Using the gcc Compiler
Getting Started with C.
Introduction to C Topics Compilation Using the gcc Compiler
and Executing Programs
Computer Science 210 Computer Organization
សេចក្តីផ្តើមពី Programming
مباني كامپيوتر و برنامه سازي
Govt. Polytechnic,Dhangar
Introduction to C Topics Compilation Using the gcc Compiler
Creating your first C program
Accomplishing Executables
2008/09/29: Lecture 7 CMSC 104, Section 0101 John Y. Park
Your first C and C++ programs
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Introduction to C Topics Compilation Using the gcc Compiler
The C Language: Intro.
An Overview of C.
Introduction to C Topics Compilation Using the gcc Compiler
Presentation transcript:

Department of Electronic & Electrical Engineering Introduction to C - The Development cycle. Why C? The development cycle. Using Visual Studio ? A simple program HelloWorld.c Running/debugging.

Department of Electronic & Electrical Engineering Why C ? Fast / Flexible / Access to hardware. Good for embedded applications. Unix + Other OS written in C C programs run on many types of processor Good selection of libraries Possible to write well structure code. Industry standard.

Department of Electronic & Electrical Engineering Why not C? With power comes responsibility. More typing then other higher level languages Some programming errors can lead to code that is very hard to debug. Languages like java do a lot more checking Possible to write very cryptic code in C! Libraries not standardised Windows Linux e.g. networking libraries

Department of Electronic & Electrical Engineering "Hello World" Summary #include int main() { printf("Hello World \n"); return 1; } Pre-processor directive IO library Function declaration Block statement (body of function) Function (part of stdio) Function call statement Character string constant First argument passed to printf Return statement Returns the value 1 Special character Carriage return Semi colon Terminates statements

Department of Electronic & Electrical Engineering python for comparison print "Hello World"

Department of Electronic & Electrical Engineering Development Cycle 1.Write code  HelloWorld.c 2.Compile code (compiler)  HelloWorld.obj 3.Fix compile time errors (syntax) goto 2. 4.Link your code with libraries (linker)  HelloWorld.exe 5.Fix linking errors (missing functions e.g. printff) 6.Run code 7.Fix run time errors (your mistakes) goto back to 1. 8.Program works !!! machine code

Department of Electronic & Electrical Engineering Development Environment (linux command line). Create your source code using the editor of your dreams... $ gedit prog.c Compile into machine code using gcc (compiler more)  prog.o $ gcc prog.c –c Link with all the libraries using gcc (linker mode)  a.out $ gcc prog.o OR in one step $ gcc prog.c