what is the diffrance between these two pointers

(char*)data

char * data

1
2
3
4
5
6
7
8
 void increase (void* data, int psize)
{
  if ( psize == sizeof(char) )
  { char* pchar; pchar=(char*)data; ++(*pchar); }
  else if (psize == sizeof(int) )
  { int* pint; pint=(int*)data; ++(*pint); }
}
char * data defines a char pointer variable named data.

(char*)data is a C-style cast. It is used in the code to convert the void pointer to a char pointer.
so void pointers are just about size ?? char has one byte so the pointer is void with only one byte ?
void does not have any size. You cannot even use that type [without casting].
Topic archived. No new replies allowed.