| 1 |
#include <stdio.h> |
| 2 |
#include <assert.h> |
| 3 |
|
| 4 |
float f=1.11; |
| 5 |
double d=3.14; |
| 6 |
|
| 7 |
char s[] = "2.22,1.234567"; |
| 8 |
|
| 9 |
int main() |
| 10 |
{ |
| 11 |
sscanf(s, "%f,%lf", &f, &d); |
| 12 |
printf("f=%f, d=%lf\n", f, d); |
| 13 |
assert(f == 2.22f); |
| 14 |
assert(d == 1.234567); |
| 15 |
return 0; |
| 16 |
} |