I hope this source code will help you with the issue. It is a simple example program that demonstrates how to access any of the strings character by character and also how to find the size of the strings.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NUMBER_OS_CHAR_STRINGS 5
/* Here input is a pointer to an array of strings */
const char *input[NUMBER_OS_CHAR_STRINGS] = {
"ONE", /*string0. string[0][0] = 'O' -> first element of string0 - O
string[0][1] = 'N' -> second element of string0 - N
string[0][2] = 'E' -> third element of string0 - E */
"TWO", /*string1*/
"THREE", /*string2*/
"FOUR", /*string3*/
"FIVE", /*string4*/
};
int RPN_calculator(const char **input);
void itterate (const char **input, int choosen_string);
int main(void) {
int string_to_itterate = 0;
RPN_calculator(input);
printf("Select the string which you would like to print char by char:\n");
scanf("%d", &string_to_itterate);
itterate(input, string_to_itterate);
return(0);
}
int RPN_calculator(const char** input)
{
int i;
for (i = 0; i < NUMBER_OS_CHAR_STRINGS; i++)
{
int n = strlen(input[i]);
printf("LENGTH OF INPUT: %d\n", n);
}
return 0;
}
/*Simple example function which itterates throught the elements of a chossen string and prints them
one by one.*/
void itterate (const char **input, int choosen_string)
{
int i;
/*Here we get the size of the string which will be used to define the boundries of the for loop*/
int n = strlen(input[choosen_string]);
for (i = 0; i < n; i++)
{
printf("The %d character of string[%d] is: %c\n",i+1, choosen_string, input[choosen_string][i] ); /*Here we print each character of the string */
}
return;
}