Hey Everyone
Right now I am writing a file that needs a queue defined as a class. The queue has a function called 'front' that should return a reference to the front element of the queue. Needs to be a reference so the element can be altered. Bloc is a defined struck to hold stock transactions.

I have tried :

bloc queue::front()
{
return (&queuearray[first])
}
or:

bloc &rtemp = queuearray[first]

The error that comes back is...

error:conversion from 'block*' to non-scalar type 'bloc' requested

Any idea whats wrong?

Recommended Answers

All 2 Replies

In the proc try

bloc& queue::front() // returns a REFERENCE
{
return queuearray[first]; // return the value, not the pointer to it
}

Thanks, works great now.

One more small question. This current program is not suppose read any data directly from file, but instead file redirection. Is it possible to set up a loop to read till end of file this way or do I at least have to open a file stream?

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.