Demo entry 2741535

spli

   

Submitted by anonymous on Sep 24, 2015 at 07:15
Language: C++. Code size: 285 Bytes.

void mySplit(char* linea, char** palabras, int &numPal) {
    char* pal;
    numPal = 0;
    pal = strtok(linea, " \t");
    while (pal) {
        palabras[numPal] = new char[strlen(pal) + 1];
        strcpy(palabras[numPal++], pal);
        pal = strtok(NULL, " \t");
    }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).