How to know heap overflow point?
I’m attempting to write a program that determines all palindrome within a given range. My program calls a function (number of digits) that returns the size of an integer (ie. 400 would be 3 as it has 3 digits), then (another – Splitis) returns a numbers place (ie. for 400, 3 would return 4 as that’s the third digit. The program then stores the independant values on a pointer array. For example, (100 would be stored as 1,0,0). As the size of each element changes, you would have to use a double pointer, one for the total numbers, then one for each element based upon the size of the number. For some strange reason, I get a segmentation fault at when my array exceeds roughly 8000 pointers. Because it always fails at that point like clockwork and it seems to work better when I make malloc smaller, I’m assuming I’m overflowing the heap somehow. Anways, I’m trying to figure out why I keep getting a segfault? The code is below.