SlideServe
Menu
Préférences
© SlideServe · v2026

Exam 3 Preview: Key Topics in ECE Application Programming with Dr. Michael Geiger

benita avatar
13 diapositives · 263 Views · Oct 02, 2014

In this lecture preview for ECE Application Programming with Dr. Michael Geiger, we cover essential exam details and key topics for Exam 3, scheduled for May 15. Students are reminded about the submission of Program 9 and the grading policies for late submissions. The exam will focus on one-dimensional arrays, pointer arithmetic, strings, two-dimensional arrays, file I/O, and structures. A Q&A session is scheduled for May 14 to clarify any topics. Students are advised to review arrays, strings, file handling, and structures in preparation for the exam.

Exam 3 Preview: Key Topics in ECE Application Programming with Dr. Michael Geiger - slide 1
01 / 13Exam 3 Preview: Key Topics in ECE Application Programming with Dr. Michael Geiger
1 / 17

Télécharger la présentation

Exam 3 Preview: Key Topics in ECE Application Programming with Dr. Michael Geiger
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. 16.216ECE Application Programming Instructor: Dr. Michael Geiger Spring 2012 Lecture 38: Exam 3 Preview

  2. Lecture outline • Announcements/reminders • Final exam: Tues., 5/15, 8:00-11:00 AM, Ball 314 • Program 9 due today • No regrades, late submissions allowed • If submitted, will replace your lowest grade • Program grading (mostly) up to date • All penalty-free regrades due 11:59 PM today unless otherwise noted • Course evaluations • Excused students • Exam 3 Preview • General exam info • Topics covered • One-dimensional arrays • Pointer arithmetic • Strings • Two-dimensional arrays • File I/O • Structures ECE Application Programming: Lecture 38

  3. Excused students • The following students are excused from the final exam (after completing a course evaluation) • Chheou, Dy • Citta, Timothy • Dongo, Mario • Hajj, Andrew • Haoui, Ali • Khuu, Jonathan • Miskell, Timothy • Muse, Bradley • Pflanz, Timothy • Pham, Philip • Taku, Jonathan • Tan, Yushi • Wall, Bradley ECE Application Programming: Lecture 38

  4. Exam 3 notes • Q & A session 5/14—what times work best? • Allowed one 8.5” x 11” two-sided note sheet • No other notes or electronic devices • Exam lasts 3 hours (but is written for ~50 min) • Covers all lectures after Exam 2 (lec. 28-37) • Format similar to Exams 1/2 • 1 multiple choice problem (File I/O & structures) • 1 code reading problem • 1 code writing problem • Practice problems posted; can also look at old exams ECE Application Programming: Lecture 38

  5. Review: arrays & pointer arithmetic • Arrays: groups of data with same type • x[10] has 10 elements, x[0] through x[9] • Can also define with initial values • e.g. double list[] = {1.2, 0.75, -3.233}; • Must be sure to access inside bounds • Array name is a pointer • Arrays are always passed by address to functions • Can use pointer to access array • Can use arithmetic to move pointer through array • p + 1  points to next element (after where p currently points) • p++  move pointer and point to next element • p--  move pointer and point to previous element ECE Application Programming: Lecture 38

  6. Review: strings • Represented as character arrays • Can be initialized using string constants • char hello[] = “Hello”; • Can access individual elements • hello[3] = ‘l’; • Can print directly or with formatting • Print directly: printf(hello); • Print w/formatting using %s: printf(“%s\n”, hello); • Must leave enough room for terminating ‘\0’ ECE Application Programming: Lecture 38

  7. Review: String functions • In <string.h> library: • Copying strings: • char *strcpy(char *dest, const char *source); • char *strncpy(char *dest, const char *source, size_t num); • Return dest • Comparing strings: • intstrcmp(const char *s1, const char *s2); • intstrncmp(const char *s1, const char *s2, size_t num); • Character-by-character comparison of character values • Returns 0 if s1 == s2, 1 if s1 > s2, -1 if s1 < s2 ECE Application Programming: Lecture 38

  8. Review: String functions (cont.) • Find # of characters in a string • size_tstrlen(const char *s1); • Returns # characters before ‘\0’ • Not necessarily size of array • “Add” strings together—string concatenation • char *strcat(char *dest, const char *source); • char *strncat(char *dest, const char *source, size_t num); • Returns dest ECE Application Programming: Lecture 38

  9. Review: 2D arrays • Declared similarly to 1D arrays • Example (see below): int x[3][4]; • Index elements similarly to 1-D arrays • Initialize:int y[3][4] = { {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12} }; • Typically used with nested for loops • Can pass to functions—must specify # columns ECE Application Programming: Lecture 38

  10. Review: File I/O • Open file: FILE *fopen(filename, file_access) • Close file: fclose(file_handle) • Formatted I/O: • fprintf(file_handle, format_specifier, 0+ variables) • fscanf(file_handle, format_specifier, 0+ variables) • Unformatted I/O: • size_tfwrite(pointer, element size, # elements, file_handle) • size_tfread(pointer, element size, # elements, file_handle) • Check for EOF using either fscanf() result or feof(FILE *) ECE Application Programming: Lecture 38

  11. Review: Unformatted I/O (cont.) • Character I/O • intfputc(int c, FILE *stream); • intputchar(int c); • intfgetc(FILE *stream); • intgetchar(); • intungetc(int c, FILE *stream); • Line I/O • intfputs(const char *s, FILE *stream); • int puts(const char *s); • char *fgets(char *s, intn, FILE *stream); • char *gets(char *s); ECE Application Programming: Lecture 35

  12. Review: Structures • User-defined types • Example: typedefstruct { char first[50]; char middle; char last[50]; unsigned int ID; double GPA; } StudentInfo; • Can define variables of that type • Scalar: StudentInfo student1; • Array: StudentInfoclassList[10]; • Pointer: StudentInfo *sPtr; • Access members using • Dot operator: student1.middle = ‘J’; • Arrow (if pointers): sPtr->GPA = 3.5; ECE Application Programming: Lecture 38

  13. Next time • Exam 3: Tues. 5/15, 8:00-11:00 AM ECE Application Programming: Lecture 38