Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing a result in a 2D array

Status
Not open for further replies.

lbucko

Programmer
Feb 13, 2002
11
0
0
IE
How do I return a text string and a numerical value to an array? At the moment I'm just printing them out, code as follows,

Code:
while(fgets(fname, 100, file) != NULL) 
{
        ffp=fopen(fname, " ");
        while(fgets(phrase, 100, ffp))
	{
		if(strstr(phrase, query) != NULL)
		{
			count++;
		}
		fclose(ffp);
		printf("%s\n","%d\n", phrase, count);
				
		count=0;
	}
}
I want to store phrase and count in an array. phrase is a char array and count is an integer. I want to return it before it is reset to 0. Any help please...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top