Get 1 week of unlimited access
Class Notes (1,051,497)
US (414,407)
CSCI (23)
CSCI 10 (18)
Lecture 13

CSCI 10 Lecture Notes - Lecture 13: Stack Buffer OverflowPremium

2 pages37 viewsFall 2016

Computer Science
Course Code

This preview shows half of the first page. to view the full 2 pages of the document.
CSCI 10 Day 13
-HW 4 due Friday
Example 22
-Array basics: creating, reading, writing, priting, copying
-An array doesn’t know its size…it doesn’t know how many entries it is
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 size cannot be changed once initialized in C++ (by only replacing
the array can you change the content of the array)
int main () {
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;
// 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;
How to sort an array:
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])
-Any function that takes an array must also take a size parameter
find more resources at
find more resources at
You're Reading a Preview

Unlock to view full version

Subscribers Only

Loved by over 2.2 million students

Over 90% improved by at least one letter grade.