in Programming edited by
252 views
5 votes
5 votes
char *strcollection[3]= {"GOClasses", "GATEOverflow", "IISc"};

For the above declaration, consider base addresses of strcollection, "GOClasses", "GATEOverflow" and "IISc” are $1000, 2000, 3000$  and $4000$ respectively.

What will be value of strcollection$+1?$

Assume character is of one bytes, integer is of two bytes and address is of four bytes.

in Programming edited by
252 views

1 Answer

2 votes
2 votes

Answer: 1004

Given ‘strcollection’ is the array of char pointers.

strcollection + 1 points to the next element of the array. The displacement (no. of bytes to move forward) depends on the “elements” of the array which are addresses.

 

The size of addresses in the system is 4B. So strcollection + 1 = 1000 + 4

 

1 comment

Yes true,

It is an array of pointers, which are pointing to strings(character array).

0
0
Answer:

Related questions