What is the value of "i"-PLEASE URGENT!!!

Write your question here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* sscanf example */
#include <stdio.h>

int main ()
{
  char sentence []="Rudolph is 20 years old";
  char str [20];
  int i;

  sscanf (sentence,"%s %*s %d",str,&i);
  printf ("%s -> %d\n",str,i);
  
  return 0;
}
Do you understand what this code does?

Do you understand what line 10 does?
No, the 10th line is problem.

When I change numbers, I always get output

Rudolf - > 20 (or any number I put instead of 20).

If I put characters, I get random number.

But I do not understand the system, what is happening in that line.
Also go to the link http://www.cplusplus.com/reference/cstdio/scanf/
to understand "%s %*s %d" and which argument gets what value.
enemy, there is an abundance of reference material for C++ and the various standard libraries, both on this site and elsewhere. A lot of your questions could be answered by a little bit of research on your own part, including this one.
Topic archived. No new replies allowed.