lec5-c - ECE 175 The if if-else and switch block command...

Info icon This preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 175
Image of page 1

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

View Full Document Right Arrow Icon
The if, if-else, and switch block command for checking program conditions The use of the debugger (GDB) to debug your programs Compile with –g flag Load file to debugger with file Set breakpoints with break Run your program step by step using run,step,next,cont Display variables with print,watch and display Use and declaration of functions, setting arguments Intro to program design 05/13/09 ECE 175, Fall 2007 2
Image of page 2
Basic components of a C program Declaration of variables (naming), available data types and their differences Assigning initial values to your variables Printing on the screen according to data type and desired format (data types, tabs, newlines, spaces) Scanning for input by the user, creating user prompts Reading and writing in files Writing flow control blocks using while, do-while, for, if, if-else, and switch statements Running and compiling your C program 05/13/09 ECE 175, Fall 2007 3
Image of page 3

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

View Full Document Right Arrow Icon
Program design How to analyze a given programming assignment to elementary components Extensive use of the Debugger to check on the validity of your program We will run most of our programs step by step to check on the execution Declaration accessing, reading and writing arrays 05/13/09 ECE 175, Fall 2007 4
Image of page 4
Problem statement: Write a C program that counts the characters, lines and words of a file. Check the validity of your program by using itself as an input (this is equivalent to the wc command in UNIX) 05/13/09 ECE 175, Fall 2007 5
Image of page 5

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

View Full Document Right Arrow Icon
Program analysis Input: a file that we want to process Output: number of words, lines and characters Algorithm design Initial condition: Read the file we want to process
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern