You are going to need separate functions for each variable type.
Array_1 and array_2 are simple character arrays, not C strings. Array_3, array_4, and array_5 are arrays of C strings.
Printing the actual content of the array in the way you want should not be too hard with printf(). Your biggest problem is the function prototypes. Look at this simple program for example:
Code:
#include <stdio.h>
#include <stddef.h>
void print_bytes(char arr[], size_t n);
void print_c_strings(char *arr[], size_t n);
int main(void)
{
char array_1[] = {'A', 'B', 'C', 'D', 'E', 'F'};
char array_2[] = {1, 2, 3, 4, 5, 6, 7, 8};
char *array_3[] = {"mm", "End of Multiple Strings Array",
"simple bluetooth connection",
"datalogging purposes and accessing recorded data",
"THE OPERATING ENVIRONMENT"
};
puts("array_1:");
print_bytes(array_1, sizeof array_1 / sizeof array_1[0]);
puts("array_2:");
print_bytes(array_2, sizeof array_2 / sizeof array_2[0]);
puts("array_3:");
print_c_strings(array_3, sizeof array_3 / sizeof array_3[0]);
return 0;
}
void print_bytes(char arr[], size_t n)
{
size_t i;
for (i = 0; i < n; ++i) {
if (arr[i] >= 0 && arr[i] <= 9) {
printf("\t%d\n", arr[i]);
}
else {
printf("\t%c\n", arr[i]);
}
}
}
void print_c_strings(char *arr[], size_t n)
{
size_t i;
for (i = 0; i < n; ++i) {
printf("\t%s\n", arr[i]);
}
}
array_1:
A
B
C
D
E
F
array_2:
1
2
3
4
5
6
7
8
array_3:
mm
End of Multiple Strings Array
simple bluetooth connection
datalogging purposes and accessing recorded data
THE OPERATING ENVIRONMENT
See, it's not that hard, but there are types and function calls to consider.