Declare an array of 20 Fraction pointers, all initialized to 0

I'm working from the ground up on a project to help me prepare for c++ next semester. This is the first part and I cant seem to find a clear explanation about it. I'm trying to create an array of 20 pointers, of struct type, all initialized to 0. Sounds simple enough but conflicting info keeps confusing me. Does this look right?



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <ctime>
using namespace std;

struct Fraction
{
	int num, den;
};
void main()
{

	Fraction **fracptrs;
	fracptrs = new Fraction *[20];
	for(int f=0;f<20;f++)
		fracptrs[f] = 0;
        system("pause")
Topic archived. No new replies allowed.