COM SCI 31 Lecture Notes - Lecture 14: Unary Operation, Undefined Behavior, Operand

44 views5 pages
26 Nov 2016
School

Document Summary

[2] const int maxsize = 5; double da[maxsize]; int k; double* dp; for (k=0; k < 5; k++) da[k] = 3. 6; da: &a[i] < &a[j] => i < j a <=> pointer to element 0 of the array, & a[0] // put 5 values in to the array int m = findfirstnegative(da, 5); if (m == -1) cout << there are no negative values in the array << endl; *dp = a[k] dp = &a[k] dp = &a[0+k] k = dp - &a[0] k = dp - a remember! }; // remember to put semicolon after close curly brace int main() // would give you an error related to int here if you forget the semicolon. Employee e1; // without initializing, name is empty string , salary and int are garbage. Employee e2; e1. name = fred ; // dot operator e1. salary = 500000; e1. age = 40; e1. age++; getline(cin, e2. name);

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents