Opps. In trying to help you, I didn't finish answering your question. Anything 
you allocate with new (or malloc in the case of C) must be deleted (or 
free()'d) when you are done with it. These allocations occur on the heap.

If you access your array with bad indices you could get heap corruption (you 
are clobbering other data on your heap), you could crash (arr[ 26 ] tried to 
access an address outside your address space, or inside your code section), or 
you could corrupt your stack (if your array[26] is an address on your stack).

Even If you corrupt the stack or heap, it may still run and appear to be 
"error" free.




--- On Tue, 1/27/09, Jos Timanta Tarigan <[email protected]> wrote:
From: Jos Timanta Tarigan <[email protected]>
Subject: [c-prog] total noob question about array
To: [email protected]
Date: Tuesday, January 27, 2009, 3:45 PM










    
            Hi, 



sorry for this noobish question :D



when you declare an array: int array[50], does the compiler allocate the 
space(hence clean up the (unused)data, or it just create a pointer start and 
end? how if you dont declare the space: int[] array; ?



how if for example i havent fill the array and try to call array[26]? will it 
return an error or a 'false' value?



thanks :)




      

    
    
        
         
        
        








        


        
        


      

[Non-text portions of this message have been removed]

Reply via email to