22 lines
454 B
C++
22 lines
454 B
C++
#include <iostream>
|
|
/*bool f(unsigned n)
|
|
{
|
|
if(n == 'x') return true;
|
|
else return f(n - 256);
|
|
}
|
|
Under what conditions does the following function terminate and return a value?
|
|
|
|
it terminates when you pass in the char 'x', otherwise you get a segmentationfault
|
|
*/
|
|
|
|
bool f(unsigned n)
|
|
{
|
|
if(n == 'x') return true;
|
|
else return false;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
std::cout << "f('a')= "<< f('a') << "\n";
|
|
std::cout << "f('x')= "<< f('x') << "\n";
|
|
} |