Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3990

C/C++ • Re: Two-dimensional array of character strings in C

$
0
0
std::vector does have an operator[] so my code could be rewritten as

Code:

    // now print out    // for every a in v    for(unsigned i = 0 ; i < v.size() ; i++)    {        // for every b in a        for(unsigned j = 0; j < v[i].size(); j++)            std::cout << v[i][j] << "   ";        std::cout << "\n";    }
I think the OP suggested that his data was comma deliminated so that was what I assumed. In real life it might be necessary to parse the input file differently.

Statistics: Posted by RogerW — Sun Feb 04, 2024 5:53 pm



Viewing all articles
Browse latest Browse all 3990

Trending Articles