1 / 8

ENEE150 Recitation 13

ENEE150 Recitation 13. Attendance Word: cold. Outline. Project 4/ADTs Void pointers Function pointers. Abstract Data Types (ADTs). Line between user and person writing the code User uses the functions that you implement to perform task Create a hash table

baird
Télécharger la présentation

ENEE150 Recitation 13

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ENEE150 Recitation 13 Attendance Word: cold

  2. Outline • Project 4/ADTs • Void pointers • Function pointers

  3. Abstract Data Types (ADTs) • Line between user and person writing the code • User uses the functions that you implement to perform task • Create a hash table • Similar to a class in object-oriented programming • Flexible

  4. Quick look at Project 4

  5. String • String • Data • Methods • compareTo • concat • equals • equalsIgnoreCase • length • toLowerCase • toUpperCase • All done for you!

  6. Void Pointers • Generic pointer • Any normal pointer…except it can point to anything • Needs to be cast • (int *) • (char *) • Always dereference a void pointer with a cast! • Even when doing pointer arithmetic

  7. Practice • Create a program that • Uses a void pointer • Void pointer is first set equal to integer a = 5 • Print the value of void pointer • Void pointer is set to char c = ‘c’ • Print the value of void pointer

  8. Function Pointer • Points to functions… • The function parameters have to match the function pointer’s expected parameters • int (*func_ptr)(int, char, char) • Function it points to • intfunc(int, char, char)

More Related