. Advertisement .
..3..
. Advertisement .
..4..
How to print char array in c? Can you give me some suggestions?
Use the For loop to Print Char Array in C: In the following example, we will demonstrate using the For loop technique and repeat precisely seven times over the six characters: Output:#include <stdio.h>
#include <stdlib.h>
#define STR(num) #num
int main(void) {
char arr1[] = { 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7' };
printf(STR(arr1)": ");
for (int i = 0; i < 7; ++i) {
printf("%c, ", arr1[i]);
}
printf("\b\b\n");
exit(EXIT_SUCCESS);
}
arr1: a1, a2, a3, a4, a5, a6, a7
Consequently, if you want to test whether it works or not, use the suggested ways here.