"Somehow linking" later on, in a simple program, is not the approach you want to take. As much as anything else, the problems are to get you thinking about how you could provide answers, as you calculate them.
You COULD write the primes out to a file, and then go back and count off the first N number of primes for your answer - but that's way inefficient. You already have the answers when you first calculate them, so just count them and print them to your screen.
Vart's pseudo code is what you should be looking at. I attempted to modify your code using for loops, but it's just not as elegant:
This is the sort of thing I believe you wanted.
This is completely untested code, so don't be surprised if it's not working.
Using names that have meaning, for your variables, will make de-bugging your code so much easier, both at the time you write it, and later, when you haven't seen it in a long time. Standard names, like i and j for loop counters, and n for number is great, but what might an 'f' be?
Note that you need sqroot variable to be a double, not an int, and it needs math.h included.
You want modulo (remainder) arithmetic for this. The product of two other numbers, in determining if n is prime, is irrelevant, AFAIK.