Since you are working with a collection of different types of information (e.g. char*, int, int), the proper way to collect this information is in a structure (or struct). You have two choices on how to create space for any array or array of struct, (1) statically allocate on stack, or (2) dynamically allocate on heap. Given your question requirement, static allocation is the most basic. However, it is not as flexible as dynamically allocating the data, and you are limited to the initial size you choose.
Just as with storing the data, you have choices on how you read the data from stdin. As a general proposition, when reading from stdin, the preferred way is to read a line-at-a-time into a buffer and then parse the buffer for the desired content. Just as above, line input is more flexible than squeezing the data into a scanf format string, but is a bit more involved. For purposes here, we will use scanf, but know that line-input with getline or fgets provide certain advantages.
Next, you can just declare the number of structs you need, or you can take the time to initialize all the values in each of the structs. (this has advantages as you will see below). Aside for allowing some iteration tricks, the primary reason you initialize all your variables is to prevent the possibility of reading from them uninitialized. Reading an uninitialized variable results in Undefined Behavior (bad). So take the time to learn how to initialize each of your variable types.
With that said, you can tell there are a number of valid ways to approach any problem. How you do it is up to you, as long as you do it correctly. Here is another approach to meet your requirements. Note that the maximum name length MAXNM and maximum number of lines to read MAXLN are defined at the top of the code. This allows you to easily adjust the values later on. Let me know if you have any questions:
#include <stdio.h>
#define MAXNM 41
#define MAXLN 100
typedef struct mix {
char name[MAXNM + 1];
int num1;
int num2;
} mix;
int main (void) {
/* initialize array of structs & variables */
mix array[MAXLN] = {{ {0}, 0, 0 }};
size_t i = 0;
size_t read = 0;
/* read array of struct contents from stdin */
while (scanf ("%s %d %d", array[i].name, &array[i].num1, &array[i].num2) == 3) {
i++;
/* check if lines > MAXLN allowed */
if (i >= MAXLN) {
fprintf (stderr, "warning: lines read from stdin exceed MAXLN.\n");
break;
}
}
/* set the number of elements read to i */
read = i;
/* iterate over elements using 'read' */
printf ("\nIterating array using 'while (i < read)'\n\n");
i = 0;
while (i < read) {
printf (" array[%zu] %-41s %4d %4d\n", i, array[i].name, array[i].num1, array[i].num2);
i++;
}
/* iterate over array by virtue of initization of name to 0/null */
i = 0;
printf ("\nIterating array using 'while (array[i].name[0])'\n\n");
while (array[i].name[0]) {
printf (" array[%zu] %-41s %4d %4d\n", i, array[i].name, array[i].num1, array[i].num2);
i++;
}
printf ("\n");
return 0;
}
Input
$ cat dat/staticstruct.txt
TheNamesofVaryingWidth 123 456
SomeOtherName 234 567
Bank_1 12 34
Bank_2 23 45
Bank_3 34 56
OneLastNameThatHasCloseToTheMaximumChars 777 9999
Output
$ ./bin/ptrarraystatic < dat/staticstruct.txt
Iterating array using 'while (i < read)'
array[0] TheNamesofVaryingWidth 123 456
array[1] SomeOtherName 234 567
array[2] Bank_1 12 34
array[3] Bank_2 23 45
array[4] Bank_3 34 56
array[5] OneLastNameThatHasCloseToTheMaximumChars 777 9999
Iterating array using 'while (array[i].name[0])'
array[0] TheNamesofVaryingWidth 123 456
array[1] SomeOtherName 234 567
array[2] Bank_1 12 34
array[3] Bank_2 23 45
array[4] Bank_3 34 56
array[5] OneLastNameThatHasCloseToTheMaximumChars 777 9999
scanf("%s %d %d",&nome[i], &rating, &ref)work?scanfalways (read from docs what it is and means) and print error (and maybe just exit) if it is not what you expect. It will save you a lot of headache...