I don't have a lot of experience & I'm trying to read these positive and negative decimal numbers from a character string as a double and store them effectively so that they can be evaluated one-by-one inside the greater for loop. My evaluation works if the numbers are given correctly(commented out), but I'm struggling to read and pass the decimal number through. This code doesn't work & gets stuck in a loop until it seg faults.

Since there are spaces between the inputs, is it best to use strtok() in some way or is the method I'm attempting suitable?

```
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>

char input[1024] = "3.2 -5.1 3.7";
char numchar[1024];
int i = 0, j = 0;
char *ptr1;
double val;
int main()
{   
    ptr1 = input;
    for(i=0;i<strlen(input);i++)
    {    

        if(isalnum(input[i]) || input[i] == '.')
            {
            while(input[i] != 32)
                {
                numchar[j++] = input[i];                    
                val = strtod(numchar,&ptr1);
                printf("Val = %lf\n", val);
                printf("ptr = %s", ptr1);
                }
            //tempVal = val
            //push(tempVal);
            }
        //EVALUATION OF CURRENT NUMBER HERE
    }
}

```