From 0863591e1aa4a172e376dcdc9c3e0d2c39a63019 Mon Sep 17 00:00:00 2001 From: Oskar Date: Mon, 12 Aug 2024 17:13:23 +0200 Subject: more --- 3p34.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 3p34.cpp (limited to '3p34.cpp') 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 +#include +#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; +} -- cgit v1.2.3