格式化输入和输出
修改字符串
//用sprintf把buffer字符串格式化
sprintf(buffer, "Age: %d, Height: %.1f", age, height);
从字符串读取数据
// 使用 sscanf 从字符串中读取数据
sscanf(data, "%d %lf", &age, &height);
修改字符串
//用sprintf把buffer字符串格式化
sprintf(buffer, "Age: %d, Height: %.1f", age, height);
从字符串读取数据
// 使用 sscanf 从字符串中读取数据
sscanf(data, "%d %lf", &age, &height);