S
shailashri_sk
Hi,
int *p;
p++; here p now increments itself with the size of integer.
similarly,
I wanted to know, how to declare an pointer to an array ( say array of
integers)
where in it we do a p++ it increments itself with the size of the
array each time it is incremented with 1.
like
p++; ie p = p + 1; // should increment with 10 if 10 is the size of
the array.
The pointer to an array, should increment the pointer with the size of
an array each time it is incremented with 1. Can we declare such a
pointers ?
one probable solution for this is
#define SIZE_ARRAY
int *p[SIZE_ARRAY][SIZE_ARRAY];
// to increment the pointer with the size of the array.
p = p + SIZE_ARRAY; // increment each time with the size.
but this does not declare a pointer to array as it simply moves to
next location if we do p = p + 1;
I know array is not the primitive data type. but is there a way to do
it ?
int *p;
p++; here p now increments itself with the size of integer.
similarly,
I wanted to know, how to declare an pointer to an array ( say array of
integers)
where in it we do a p++ it increments itself with the size of the
array each time it is incremented with 1.
like
p++; ie p = p + 1; // should increment with 10 if 10 is the size of
the array.
The pointer to an array, should increment the pointer with the size of
an array each time it is incremented with 1. Can we declare such a
pointers ?
one probable solution for this is
#define SIZE_ARRAY
int *p[SIZE_ARRAY][SIZE_ARRAY];
// to increment the pointer with the size of the array.
p = p + SIZE_ARRAY; // increment each time with the size.
but this does not declare a pointer to array as it simply moves to
next location if we do p = p + 1;
I know array is not the primitive data type. but is there a way to do
it ?