1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
int pow (int t,int s);
int t =5, s=3;
int main ()
{
int a=5,b=3;
cout<<pow(a,b)<<endl;
return 0;
}
int pow (int t, int s)
{
if (t>=1)
return t * pow(t,s-1);
else
return 1;
}
|
when I try to build it windows stops, when I try to single step it, it shows me unhandled stack overflow.
This is output message:
'UNIQUE.exe': Loaded 'E:\my project\UNIQUE\Debug\UNIQUE.exe', Symbols loaded.
'UNIQUE.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'UNIQUE.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'UNIQUE.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'UNIQUE.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'UNIQUE.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
First-chance exception at 0x011448a9 in UNIQUE.exe: 0xC00000FD: Stack overflow.
Unhandled exception at 0x011448a9 in UNIQUE.exe: 0xC00000FD: Stack overflow.