suppose i declare an array of size 10(a) and i try to use even 11th or 12th element...that is i try to put some data...and later extract from a or a ..is it possible..ans with respect to both c and c++..
It sure is possible, since C/C++ offers no built-in bounds checking. The 11th and 12th elements will refer to the memory location of the array (a) + 10 and + 11 respectively. What is in those memory locations would be difficult to say, and would be implementation specific. You could possibly be reading/writing values from other variables/arrays, unallocated space in the heap, or the OS could terminate the program if it goes beyond the programs allocated memory.
Basically, it's undefined and you shouldn't do it. You can't be sure if the data will be the same when you go to access it, and it could mess up other values or cause the program to terminate.
More than likely, your program will terminate immediately. Sometimes it will keep going, overwriting memory that you're not supposed to will almost certainly cause your program to malfunction somewhere later. My advice is that you're not supposed to do it.
also will the answer be same even i declare the array dynamically??
That just means you don't know at compile time what size it will be, so the memory for it gets allocated during running. Once it's allocated, it's just an array like any other. There's no magic that would make it expand or shrink without you having to do it yourself.
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...