I am making a program which asks user for input and then separates it from comma and adds all separated values to an array. But as you can see, when I print the first value of the array, it doesnt print anything. Im a beginner.
#include <iostream>
#include <string>
#include "Header.h"
#include "Windows.h"
#include <array>
 
void Seperate(std::string input, std::string(*ptr)[50]) {
    if (input[input.length() - 1] == ',')
    {
        input.erase(input.length() - 1, 1);
    }
    std::string value;
    int length = input.length();
    for (int i = 0; i < length; i++) {
        if (input[i] != ',') {
            value += input[i];
        }
        else {
            (*ptr)[i] = value;
            value = "";
        }
    }
}
int main() {
    std::cout << "Enter comma seperated values to seperate: ";
    std::string input;
    std::cin >> input;
    std::string list[50];
    std::string(*ptr)[50] = &list;
    Seperate(input, ptr);
    std::cout << list[0];
}
 
    