In the following program,if I add 1 to a void pointer, it moves one byte ahead.But,quite as expected, it moves 4 and 8 bytes respectively for int
and double
pointers.Why does the void pointer move by 1 byte,just as a character pointer would?
#include<stdio.h>
int main(void)
{
int num=3,*int_ptr=#
double sum=3,*double_ptr=∑
void *void_ptr1=&num,*void_ptr2=∑
printf("%p,%p,%p,%p,%p,%p,%p,%p",void_ptr1,void_ptr1+1,\
void_ptr2,void_ptr2+1,int_ptr,int_ptr+1,double_ptr,double_ptr+1);
}