Just trying to see what the sscanf does and got stuck with the following program. Though i can understand the error (trying to write to an address which is random , this is what i think). let me know if i am wrong
[insert]
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char * ints = "20, 40, 60";
char * floats = "10.5, 12.5";
char * hexs = "FF, F";
int i;
int n;
float f;
int h;
char *s;
n = sscanf(ints , "%d", &i);
printf("\n %d", i);
printf("\n sscanf returns %d\n\n", n);
n = sscanf(floats , "%f", &f);
printf("\n %f", f);
printf("\n sscanf returns %d\n\n", n);
n = sscanf(hexs , "%x", &h);
printf("\n %d", h);
printf("\n sscanf returns %d\n\n", n);
n = sscanf(ints , "%s", s); // ERROR IS HERE
printf("\n %s", s);
printf("\n sscanf returns %d\n\n", n);
return 0;
}