|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (10 bit)
Join Date: Jul 2002
Location: University of California, Santa Barbara
Posts: 800
|
C++, Returning a boolean array
In C++ I want to write a function which returns a boolean array, but I can't seem to do it as either a return value, or a reference parameter. Is there any way I can do it without resorting to a global variable?
|
|
|
|
|
|
#2 |
|
Registered User
Join Date: Nov 2001
Posts: 1,965
|
How I usually do it:
Code:
#include <iostream>
void func(bool* array) {
array[0] = true;
// ...
}
int main(void) {
bool arr[10];
func(arr);
std::cout << arr[0];
return 0;
}
|
|
|
|
|
|
#3 |
|
Member (10 bit)
Join Date: Jul 2002
Location: University of California, Santa Barbara
Posts: 800
|
Thanks for the tip.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|