I am trying to assign new value for my char s[128] array. But after performing function, the address of the s doesn't change. On the other hand the function works just fine for the ints.
void myscanf(const char *type, void *var){
char buffer[128];
memset(buffer,0,sizeof(buffer));
int size = read(0, buffer, 128);
if(strcmp(type, "%d") == 0){
int *d = (int*)var;
*d = buffer[0] - '0';
}
else if(strcmp(type,"%s") == 0){
char* str = (char*) var;
str = buffer;
}
}
int main(){
int d;
char s[128];
myscanf("%s", s);
return 0;
}