Untitled

 avatar
unknown
c_cpp
a year ago
613 B
3
Indexable
#include <iostream>

void printEvenIndexedLetters( char** words, int wordCount )
{
    for( int i = 0; i < wordCount; ++i )
    {
        char* word = words[ i ];
        for( int j = 0; word[ j ] > 0; ++j )
        {
            if( j % 2 == 0 )
            {
                std::cout << word[ j ];
            }
        }
        std::cout << '\n';
    }
}

int main()
{
    const int wordCount = 3;
    char* words[ wordCount ] = {
            ( char* )"Example", ( char* )"Function", ( char* )"CharArray"
    };

    printEvenIndexedLetters( words, wordCount );

    return 0;
}
Editor is loading...
Leave a Comment