584 views

3 Answers

1 votes
1 votes
Int A[3]={0,1,2}

A++;

in your given code A is the name of array, and it is also used as address of whole array.

as you increasing A means u r trying to access out of scope memory.

Let us consider A(address of array)=1024

As u increase A it becomes 1024+3*sizeof(int);
1 votes
1 votes
In C , array declaration the name of array(in this question 'A') is considered as constant which is nothing but  address of first element of array. Cannot modify it

you can do A+2 which is eqivalent to &A[2] .

but Cannot do A++ beacause A++ modifies the base address of array. A++ is euivalent to A=A+1.
0 votes
0 votes
Compilation error....more specifically symentic error....base address constant pointer u can't chng it..

Related questions

4 votes
4 votes
1 answer
1
0 votes
0 votes
2 answers
2
vishalmessi asked Dec 11, 2016
4,031 views
#include <stdio.h int main() { int a[][3] = {1, 2, 3, 4, 5, 6}; int (*ptr)[3] = a; printf("%d %d ", (*ptr) , (*ptr) ); ++ptr; printf("%d %d\n", (*ptr) , (*ptr) ); return ...