What is the practical use of the formats \"%*\" in scanf(). If this format exists, there has to be some purpose behind it. The following program gives weird out
In scanf("%*d",&a) * skips the input. In order to read the inputs one has to use an extra "%d" in scanf. For example:
int a=1,b=2,c=3;
scanf("%d %*d %d",&a,&b,&c); //input is given as: 10 20 30
O/p:
a=10 b=30 and c=3; // 20 is skipped
If you use another %d i.e: scanf("%d %*d %d %d",&a,&b,&c); //input is given as: 10 20 30 40
then a=10 b=30 c=40.
If you use "," in scanf then no value will be taken after %*d i.e;
scanf("%d %*d,%d" &a,&b,&c)// 10 20 30
O/p:
a=10 b=2 c=3 will be the output.