Download presentation
Presentation is loading. Please wait.
1
CGS3460 Summer 2011 Programming Using C
Andrei Todor
2
Syllabus http://www.cise.ufl.edu/class/cgs3460su11/ Class Study
Program Homework (25%) Quiz (25%) Midterm(25%) Final(25%)
3
Computer Programming Program Computer program Problem Solution
General - e.g.: find minimum of a list of numbers Instance - e.g.: find minimum of 3,4,-1 Solution General: e.g.: look at each number Instance: -1
4
Computer Programming Algorithm Pseudocode Sequence of steps
Solution to a general problem Input: instance of the problem Output: solution for the instance of general problem Pseudocode Formal description of steps E.g. Store the value of the first number Look at each number and if it is smaller than the stored value, replace it Output the stored value
5
Computer Programming Machine Language Programming language
E.g.: Programming language Between pseudocode and machine language E.g.: C Syntax (grammar) Source code Compiler – e. g. gcc Execution
6
Computer Programming Errors Debugger Syntax – compile time
Logical (bug) – run time Debugger
7
Overview solve code compile Problem Solution/Algorithm
Program/Source Code implement English Pseudocode Programming Language (C) Paper Paper Text file Input Data (Problem instance) Output (Solution to problem instance) execute Executable Program Machine Language Binary file
8
Programming Environment
Get class account UNIX servers thunder.cise.ufl.edu storm.cise.ufl.edu
9
Programming environment
Remote terminal access Remote file transfer Editor Compiler IDE UNIX – local (CISE labs) NA emacs gedit gcc KDevelop UNIX – remote (other Unix computers) ssh, sftp Windows&UNIX Putty WinSCP Windows Vim MinGW Dev-C++ Visual Studio
10
Basic UNIX Use Putty to connect to thunder
Working directory: ., pwd, cd, ls, Up directory: .. Home directory: ~
11
First C program emacs hello.c CTRL+X CTRL+C to save gcc hello.c
Execute gcc argument –o Details of gcc Preprocessing Compilation Link-editing
12
C syntax Backus Naur Form (BNF) <C_program>::=
<preprocessor_directives> <function_definitions> <preprocessor_directives>::= <preprocessor_directive>[<preprocessor_directives>] <preprocessor_directive>::= <include_directive>|… <include_directive>::= #include < <header_file> >
13
C syntax <function_definitions>::= <function_definition>[<function_definitions>] <function_definition>::= <function_header><function_body> <function_header>::= <return_type><function_name> <formal_parameter_list> <function_body>::=<compound_statement> <compound_statement>::= { [declarations][<statements>] }
14
C syntax <statements>::=<statement>[<statements>] <statement>::= <simple_statement>; |<compound_statement> |… <simple_statement>::= <expression> |<return_statement>
15
C syntax <expression>::= <function_call> |<constant> |… <function_call>::= <function_name><actual_parameter_list> <actual_parameter_list>::= ([<expresion>,…]) <return_statement>::=return <expression>
16
C Syntax <constant>::=<number_literal>|<string_literal> <number_literal>::=[-]digits[.][digits] <digits>::=<digit>[<digits>] <digit>::=0|1|…|9 <string_literal>::=“ <characters> ” <characters>::=<character><characters> <character>::=A|B|…|z|0|…|9|(|)|!|<|>|.|*|…
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.