CSCI 10 Lecture Notes - Lecture 13: Stack Buffer Overflow

69 views2 pages

Document Summary

An array doesn"t know its size it doesn"t know how many entries it is const int sz = 10; //size variable int a[sz]; for (int i = 0; i < 10; i++) a[i] = 0; B = a; // invalid array assignment return 0; responsible for. The old standard should be a constant variable that holds the array size. Now we can ask the user to input to the size variable to specify size of the array. Array size cannot be changed once initialized in c++ (by only replacing the array can you change the content of the array) int main () { // find min in array int smallest = nums[0]; for (int i = 1; i < n; i++) { if (nums[i] < smallest) { smallest = nums[i]; cout << smallest << endl; Find the biggest, and swap it with the very last entry in the array, repeat the process with the rest of the array (except arr[-1])

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