Array name is a constant pointer pointing to the base address(address of the first byte where the array begin) of the memory allocated. When you use arr[i], the compiler manipulates it as *(arr + i). Since arr is the address of the first element, the value of i must be 0 for accessing it. Hence all arrays begin with an index of 0.
The compiler thinks that 0 is a positive number. we have an integer range of -128 to 127. here -128 to -1 are negative numbers and 0 to 127 are positive numbers so array starts with the 0 as index.
What will be output of the following code #include using namespace std; class abc { public : void main() { cout<<" Its main function "< } }; int main(int c, char **v) { abc a; if(c<1) { cout<<" Error can not accept it "< exit(1); } cout<<" its in main program "< a.main();
How is static variable stored in the memory? ( if there are 2 functions in a file,and the static variable name is same (ex var) in both the function. how is it keep seperately in the memory).