I want to scanf input like: \"John, Surname, 9999\" and commas should not be assigned to the scanned variable; spaces at the end and start of input deleted... Now t
You can specify to match everything except commas:
int c = scanf("%[^,], %[^,], %i", &p->name, &p->surname, &p->index);