CSCI 103L Lecture Notes - Lecture 7: Null Character
36 views2 pages
10 Mar 2016
School
Department
Course
Professor
Document Summary
C/c++ only remembers where an array starts, does not remember the length like other languages might: can"t say array[]. length, can go over the size of the array and get some garbage. Hackers use this to land into other data locations past the end of the array. The name of the array without [] evaluates to the starting address. C does not keep track of the size so you have to either send the size of the array as an argument or have the function only accept arrays of a certain size. If you just pass the arrays address you are passing-by-reference : doesn"t make a copy just tells the address, then you can use the address in your function to modify items in the array by using array[i]. Multidimensional arrays: can be used for images, matrix arrays are 2 dimensional arrays, a 2d array is just 2 dimensions in the declaration. Ex: int my_matrix[2] [3]: 3d arrays.