Can anyone tell me if it is possible to set a value in an array to infinity and if so how to go about it?
Thanks.

Recommended Answers

All 3 Replies

string stuff[10];

stuff[2] = "infinity";

for(int i=0; i<10; i++)
{
     cout << stuff[i] << endl;
}

If you are talking about an int or float array, the answer is no because there is no such value as infinity. Integers have maximum values, which are declared in limits.h header file.

Yes i was meaning an int array, will just have to try it with max value instead. Thanks.

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.