现在的位置: 首页 > 综合 > 正文

sscanf

2011年12月25日 ⁄ 综合 ⁄ 共 184字 ⁄ 字号 评论关闭
/* sscanf example */
#include <stdio.h>

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

  sscanf (sentence,"%s %*s %d",str,&i);
  printf ("%s -> %d\n",str,i);
  
  return 0;
}

Output:

Rudolph -> 12

抱歉!评论已关闭.