How to print the second row of a matrix of characters in C++

1 Answer

0 votes
#include <iostream>

int main() {
    char matrix[][4] = {
        {'a', 'b', 'c', '\0'},
        {'d', 'e', 'f', '\0'},
        {'g', 'h', 'i', '\0'},
        {'j', 'k', 'l', '\0'}};

    std::cout << matrix[1] << "\n";  
}

 
  
/*
run:
  
def
  
*/

 



answered Mar 15, 2024 by avibootz

Related questions

1 answer 134 views
1 answer 158 views
1 answer 118 views
1 answer 145 views
2 answers 141 views
...