i was having difficulty understanding these lines of code,these are from a c program,could somebody please help me to understand these by giving a detail explanation (especially the printf statement )
vpointer can hold any type of pointer value as it is void...
charpointer stores the memory location of g character. (the first letter).
The size of a char is 1 byte. Therefore when we increase the value of char pointer by one, it will change the address location by one byte.
(char*)vpointer --> This is now a char pointer.
(char*)vpointer +3 --> Now this is the address is increased by 3. Therefore this represent the address of g (The fourth letter)
When we store a string in a char pointer, it will add value zero char at the end.(To recognize the end of the string). Therefore actually google is stored in memory as 0,101,108,103,111,111,103
When we tell printf to print a string (Using %s), this will determine the end using zero.
Only 0,101,108,103 are in the new string. Therefore this prints 'gle' only..