Compiler issue.

Hello,
I'm trying to create a data area within an .exe file. Then I will open the .exe file and scan it for the data area. When the data area is found, I will write some data to this data area and write the .exe file back to disk. I want to accomplish this by creating a character array in my source file like so:

char arr[] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";

Then that should be stored in the .exe file somewhere. The problem is, all of those A's don't appear anywhere in the .exe file . I know why, it's because the compiler ignored the array because I didn't reference it. If I reference it, by using a simply for loop and incrementing each element of the array, then those A's do appear in the .exe file as expected.

So, my question is, is there anyway to keep the compiler from deciding for me what I need or don't need in my code? So that I don't have to reference the array in order to get it included in the compilation process? I thought maybe this problem had to do with the compiler's optimization but I turned off the optimization feature in the compiler's configuration but with no luck. I'm using Visual Studio Community 2015. Any help would be appreciated.
Thanks.

Ok. Assuming I have misjudged you, a lot of compilers these days, such as Visual Studio, employ what is called something like address randomization in order to make it more difficult to corrupt software. IE, the address of something like your array will not be at the same relative location every time it is compiled or run. You might be able to insert a tag in the code that will allow you to pinpoint where your target address really is. IE, doing something like allocating a bit more space for the array, and then insert the tag at the end of the array. Where you find your tag, you can then compute there the beginning of the array would be. Let's say you want a char array of 100 bytes (including terminating null byte), and you are using a tag of "xyzzy". Then, allocate an array of 106 bytes and append the string "xyzzy" (including terminating null byte) at &array[100]. I haven't done this myself, so this is a "theoretical" approach, but it should work.

To continue, in your example, you have defined an unused string on the stack. The compiler will, optimizations notwithstanding, not include it in the image. You need to do something with it in your code. Also, it is on the stack. Put it on the heap in an extern variable using a malloc/calloc or strdup call, and then do something with it. You might be able to declare it as an extern without allocating the space with the code you show, but inside a function it is a stack-based variable and therefore not accessible until the function is called, but the fact that the compiler will remove it since it is unused, this is where your problem resides. Have fun!

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...