C Programming

C Programming

C PROGRAMMING 6996 Columbia Gateway Drive Suite 100 Columbia, MD 21046 Tel: 443-692-6600 http://www.umbctraining.com C PROGRAMMING Course # TCPRG3000 Rev. 10/14/2016 ©2016 UMBC Training Centers 1 C PROGRAMMING This Page Intentionally Left Blank ©2016 UMBC Training Centers 2 C PROGRAMMING Course Objectives ● At the conclusion of this course, students will be able to: ⏵ Write non-trivial C programs. ⏵ Use data types appropriate to specific programming problems. ⏵ Utilize the modular features of the C languages. ⏵ Demonstrate efficiency and readability. ⏵ Use the various control flow constructs. ⏵ Create and traverse arrays. ⏵ Utilize pointers to efficiently solve problems. ⏵ Create and use structures to implement new data types. ⏵ Use functions from the C runtime library. ©2016 UMBC Training Centers 3 C PROGRAMMING This Page Intentionally Left Blank ©2016 UMBC Training Centers 4 C PROGRAMMING Table of Contents Chapter 1: Getting Started..............................................................................................9 What is C?..................................................................................................................10 Sample Program.........................................................................................................11 Components of a C Program......................................................................................13 Data Types.................................................................................................................14 Variables.....................................................................................................................16 Printing and Initializing Variables...............................................................................17 Arrays.........................................................................................................................19 Compiling and Executing a C Program......................................................................21 Chapter 2: Functions and Operators...........................................................................25 Functions....................................................................................................................26 Elementary Operators................................................................................................28 Assignment Operators................................................................................................29 Increment and Decrement Operators.........................................................................30 Number of Operands..................................................................................................32 Conditional Operator..................................................................................................33 Chapter 3: Control Flow Constructs............................................................................39 Conditionals................................................................................................................40 if..................................................................................................................................41 if-else-if.......................................................................................................................43 switch..........................................................................................................................45 Loops..........................................................................................................................46 while............................................................................................................................47 for................................................................................................................................48 do-while......................................................................................................................49 Endless Loops............................................................................................................50 break and continue.....................................................................................................51 switch..........................................................................................................................53 Chapter 4: The C Preprocessor....................................................................................61 #define........................................................................................................................62 Preprocessor Macros.................................................................................................64 #include......................................................................................................................66 Conditional Compilation.............................................................................................67 #ifndef.........................................................................................................................69 Chapter 5: Simple I/O.....................................................................................................73 Character I/O..............................................................................................................74 End of File..................................................................................................................76 Simple I/O Examples..................................................................................................78 Simple I/O Redirection...............................................................................................80 I/O with Character Arrays...........................................................................................81 ©2016 UMBC Training Centers 5 C PROGRAMMING Chapter 6: More on Functions......................................................................................85 Introduction.................................................................................................................86 Function Declarations.................................................................................................87 Returning a Value or Not............................................................................................88 Function Prototypes...................................................................................................89 Arguments and Parameters.......................................................................................91 Organization of C Source Files..................................................................................93 Extended Example.....................................................................................................94 The getaline Function.................................................................................................96 The mystrcmp Function..............................................................................................97 The check Function....................................................................................................98 The myatoi Function...................................................................................................99 The average Function..............................................................................................100 Summary..................................................................................................................101 Chapter 7: Strings........................................................................................................105 Fundamental Concepts............................................................................................106 Aggregate Operations..............................................................................................108 String Functions........................................................................................................110 String Functions Example........................................................................................112 Chapter 8: Pointers......................................................................................................115 Fundamental Concepts............................................................................................116 Pointer Operators and Operations...........................................................................118 Changing an Argument with a Function Call............................................................119 Pointer Arithmetic.....................................................................................................121 Array Traversal.........................................................................................................123 String Functions with Pointers..................................................................................127 Pointer Difference.....................................................................................................129 Prototypes for String Functions................................................................................130 Relationship Between an Array and a Pointer.........................................................131 The Pointer Notation *p++........................................................................................132 Chapter 9: Structures..................................................................................................137 Fundamental

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    210 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us