Char array to 2D int Array of ints

I'm using an Arduino to read a Char array from a file with the following format:

[File Description][\n]

[Col1 title],[Col2 title][\n]

[double1,1],[double1,2][\n]

[double2,1],[double2,2][\n]

[doublen,1],[doublen,2][\n]

what is the best way to separate out [double1,1]to[doublen,n] and represent them as a 2D array of n elements?

Also, is there any way to "pass up," the array such that it becomes accessible to another function that does not call the converting function? I understand a variable global could be created with a very large element allocation, but my value n could range between 2 and 300 and it seems like a waste of good dynamic memory to have that many unused spaces available in a global.

Here's a skeleton of the way I understand to do it so far any input on how I should change the structure or if there's anything I need to change

    char input[300]={'H','e','l','l','o','\n','1','.','1',',','2','\n','3',',','4','\n'};
    //this is an nx2 array and is read from a file.

    void setup() 
    {
      ParseChar(input);
      foo(FileArr);
    }
    
    int[][] ParseChar(char[] input)
    {  
      //find number of new lines in the input to initialize FileArr
      int lines=0;
      for (int i=0; i<sizeof(input); i++)
      {
        if(input[i]=='\n')
        {
          lines++;
        }  
      }
    
      //set up int array 
      int FileArr[lines][2];
      //test to write to col 1 or col2 of array
      int wline=0;
      int num=-1;
      //start reading for values
      for (int i=0; i<sizeof(input); i++)
      {
        if(input[i]==',')
        {
          if(num>-1)
          {
          //change col
          FileArr[wline,0]=num;
          //protect from possible garbage?
          num=-1;
          }
        }
        else if(input[i]=='\n')
        {
          if(num>-1)
          {
          //change col
          FileArr[wline,1]=num;
          //protect from possible garbage?
          num=-1;
          }
        }
        else if(isDigit(input[i]))
        {
          //read until ',' or '\n'
          while (isDigit(input[i]))
          {
            //read in digits
            i++;
          }
          //num=[output of above loop]
        }
        i++;
      }
      //turn FileArr into a global variable so an unrelated function can call it
    }

    void foo (int[][] Arr)
    {
      //print Arr to serial port one line at a time
    }

Edit: To make matters worse, I just realized that these values will be doubles with decimal points

You can't return an array of arrays from a function. You can return a pointer to a pointer, but it is simpler to make the 2D array global.

strtok() and atoi() are your friends.

PaulS:
You can't return an array of arrays from a function. You can return a pointer to a pointer, but it is simpler to make the 2D array global.

strtok() and atoi() are your friends.

If I make the 2D array global, how would I go about sizing it correctly? It is my understanding that once you set the size of a global array, you can't change it.

Also, don't strtok() and atoi() only work for Strings? How would I go about using them with an array of chars?

Also, don't strtok() and atoi() only work for Strings?

No. They work only for strings, which are NOT the same thing as Strings.

You are correct in that the size of the array needs to be fixed. Or, you can use the pointer to pointer method, dynamically allocating the memory to be pointed to, using malloc().

But, consider that the code will need to handle the largest possible array, so you can't write it in such a way that it uses the memory that is not used by the array for some other purpose, because under some circumstances, that memory will not be available.

So, you might as well statically allocate the array of the maximum size.