0
Hello there!, Who can help me to know ? What do this %*c?I am working in C
This is line of my code scanf("%c%*c",&r);
5 Respostas
+ 3
Having a function:
void func(char *out) {
*out = 'a';
}
calling it with:
char f;
func(&f);
updates f = 'a' so yes you get a pointer to char.
+ 3
Your scanf reads 2 characters. %c specifies read a character storing it in the r variable. The %*c specifies read a character and do not stored it.
+ 3
Say your input is "a b":
char f,s;
scanf("%c%*c%c", &f, &s);
sets f = 'a'; s = 'b'; and the ' ' is tossed. You need to pass the addresses of f and s so scanf can write to them so &f gets the address of f.
+ 1
thank you so much!
0
is second parameter is apointer to Char?
sorry, but in the book that I read some Codes use %*c, so I am lost, for example
prinntf("add ID studen"); scanf("%d%*c",&h.nal);
printf("curse");.
scanf("%d%*c",&a.curse);