diff options
author | Oskar <[email protected]> | 2024-08-12 17:13:23 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-08-12 17:13:23 +0200 |
commit | 0863591e1aa4a172e376dcdc9c3e0d2c39a63019 (patch) | |
tree | 38289669b386ba7a31610ad46cbf921652336195 /3p34.cpp | |
parent | 4555acdaeae73b8c2d49696c9766366ead8eb847 (diff) |
more
Diffstat (limited to '3p34.cpp')
-rw-r--r-- | 3p34.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/3p34.cpp b/3p34.cpp new file mode 100644 index 0000000..84d148b --- /dev/null +++ b/3p34.cpp @@ -0,0 +1,28 @@ +#include <iostream> +#include <vector> +#include "sales_data.hpp" +#include "sales_item.hpp" + +/* + * + * 3.34 + * + * + */ + +int main () { + + int ia[] = {1,2,3,4,5,6,7,8,9,10}; + int *p1 = ia + 12; + int *p2 = ia + 0; + // Well as long as p2 is pointing to a valid element in the array it seems like + // changing values in p1 cant make it illegal. + // Though if i change p2 to point to -1 or lower then i get a buffer underflow + + // -12 + // p1 = -12 + // p1[-12] = ia[0] + p1 += p2 - p1; + std::cout << *p1 << " " << *p2 << std::endl; + return 0; +} |