I have a problem where I need to read in multiple arrays from a .txt file and output the maximum sum subarray. Here is the text file:
[1, 4, -9, 8, 1, 3, 3, 1, -
Read in the file with fread
calls into a buffer. Explode buffer per line (\n) / array. (Count how many arrays do you need and prepare.) Explode lines per numbers - separator: comma and space. (Count length of array and allocate.) Numbers would contain sign and digits. Assuming digits are contiguous in range '0'..'9', '0'+digit gives the value of the digit. Value of the number can be calculated from sign, digit values and their order.