CMPT 125 Lecture Notes - Lecture 4: C Data Types

11 views2 pages

Document Summary

Write a function that gets a 2d array, and check if there are two equal rows in the array. stdbool. h. Write a function that gets an array of ints and a number and checks if it is contained in the array. #include bool contains(const int* array, int len, int elt) { bool found = false; int i = 0; while (i < len && !found) { if (array[i] == elt) found = true; i++; return found; found == false. // default values are assigned starting from 0. // i. e. , hearts = 0, spades = 1, clubs = 2, diamonds = 3; enum emphasis {bold = 1, italic = 2, underline = 4}; // can define integer values of the names. Usage: enum suit card = spades; // variable of type enum suit. Typedef is used to give a name to a data type.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents