Well the way to keep those two things associated is to use a structure, not a 2D array where the minor dimension is a small constant (ie 2).
As well as being more readable, its also far more extendable.
Here's the general idea of the bits you need - if you've got the file reading bit all figured out, shouldn't be too difficult.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
char *code;
char *name;
} product_st;
// you may have strdup in your library
char *string_dup ( char *name ) {
char *res = malloc( strlen(name) + 1 );
strcpy( res, name );
return res;
}
int main ( ) {
char in_code[100], in_name[100]; // input strings
int num_products = 0; // number so far
int max_products = 100; // initial guess
product_st *products = malloc( max_products * sizeof(product_st) );
// read the file to get string
// this goes inside your loop.
products[num_products].code = string_dup( in_code );
products[num_products].name = string_dup( in_name );
num_products++;
if ( num_products == max_products ) {
// read about realloc
}
// end loop
return 0;
}