Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

It doesn't compile wtf did I do wrong?

Name: Anonymous 2006-03-27 10:54

#include <iostream>
#include <cstdlib>
#include "Circle.h"
using namespace std;

int main()
{
    int node;
    cout << "Number of nodes: ";
    cin  >> node;
    cNode *circle = new cNode[node];
    int nodeVal[node];                      
    int nodes = node;
    while (node >= 0){
         cout << "\nInput value for node " <<(nodes - node + 1) << endl;
         cin  >> nodeVal[(nodes - node)];
         node--;
    }
    node = nodes;
    while (node >= 0){
         int curNode = (nodes - node);
         *circle[curNode].setValue(nodeVal[curNode]);
         node--;
    }
}

29 R:\Ants.cpp invalid type argument of `unary *'

Name: Anonymous 2006-03-27 11:50 (sage)

*circle[curNode].setValue(nodeVal[curNode]);

this doesn't make sense because:
1. arrays are the same as pointers in C, so there's nothing to dereference
2. that actually would be dereferencing the return value of setValue and doing nothing with it, anyway

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List