#include <stdio.h>
#include <conio.h>
void *memset(void *dest,int value,int cnt);
void *memset(void *dest,int val,int cnt)
{
void *start=dest;
while(cnt--)
{
*((char *)dest)++=(char)val;
}
return start;
}
int main()
{
char arr[]={1,2,3,4};
memset(arr,0,4);
printf("%s",arr);
_getch();
return 0;
}
error : ++ need lvalue
I know how to resolve this,but I want to know the reason for that?
I think this is a special case when we use a cast operator.
compiler : VS 9
Cheers!!