Hi there i have a txt file containing these variables
anil just_go_with_it 5
betty the_dark_knight 3
anil source_code 3
carrie just_go_with_it -3
anil paranormal_activity -5
doug the_dark_knight 5
betty shawshank_redemption 5
carrie source_code 1
betty paranormal_activity 5
carrie shawshank_redemption 5
doug shawshank_redemption 3

what im trying to do is to sort them in a 2d integer array, where the name of the person is the row and the name of a movie is a column and the numbers are at the locations of the row and column...

can someone help me out cheers..

Names and movies are not integers. Perhaps you should consider another data structure. Maybe an array of something like:

struct {
   char * name;
   char * movie;
   int rating; 
}

what im actually trying to do is, set the name of a person and the movie a number , which represents the row and cols. so for the example above there is 4 rows, indicating to 4 names, and there are 5 columns, which are the 5 movies, and in that i want to store the numbers shown in the example

Do you know the number of names/movies in advance or do you need to get that from the file?

i have to get them from the file as seen above

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.