Data_Structure/作業/unit4/test.c
2025-01-20 21:30:53 +08:00

18 lines
363 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <stdio.h>
#include <stdlib.h>
int main()
{
char str[30] = "-20.30300 This is test";
char *ptr;
double ret;
int i = 0;
ret = strtod(&str[4], &ptr);
int len = ptr - &str[i];
printf("數字double是 %f\n", ret);
printf("字符串部分是 |%s|\n", ptr);
printf("len =%d ,&ptr=%d ,&str[i]=%d ", len ,&ptr ,&str[i]);
return(0);
}