Print 2d array of strings in C

This article focuses on printing the words or characters in a 2d array in a most effective way.

Photo by Nikhil Mitra on Unsplash


The C library function int puts(const char *str) writes a string to stdout up to but not including the null character. A newline character is appended to the output.

int puts(const char *str)

Printing using two for loops

In the below code snippet we will be printing the 2D array of characters using two for loops.

Printing using puts() function

The below example will print the strings in a single for loop using the puts() function. A new line is added by default to the strings.


Using the puts() method we can print the strings using a single for loop. Happy coding!

Python Developer | Django Developer | Python Enthusiast