C++ :: Function Causing Infinite Recursion Crash
Oct 24, 2014
This function is apparently causing infinite recursion, but I have no clue what's causing it:
Code:
int pow( int base, int exp ) { int somevariable = pow(base,exp-1);
if (exp == 0) {
return 1;
}
else {
return base * pow(base,exp-1);
}
}
View 10 Replies
Dec 13, 2013
I have a class which dynamically allocates memory for three data arrays, and as such in the destructor I told it to delete those data arrays.
However, when I've created a new class, and inherited the previous class - it will always crash AFTER running the program, unless I don't have the previous destructor present.
View 3 Replies
View Related
Oct 30, 2014
while(!secList.empty()){
Security se = Security();
se = secList.extract(); // CRASH
cout << "Security info: " << se.security << endl;
cout << "Transaction List: " << endl;
while(!se.tranList.empty()){
Transaction tr = Transaction();
[code]....
my program crash when it try to assign the return value of the function to the local value. extract function does return correct value, but it just crash when done executing.
View 4 Replies
View Related
May 8, 2014
So i have a program it works which takes in a word reverses it prints it out. BUT! the problem is that the program is without recursion. convert the function into recursion.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
[Code].....
View 2 Replies
View Related
Apr 3, 2013
How do function count factorials in this program?
#include<iostream>
#include<conio.h>
using namespace std;
void main(){
unsigned int factorial(unsigned int value);
[Code] .....
View 7 Replies
View Related
Mar 19, 2013
I have a linkedList search function given and I am having a little trouble getting it to work. I've made a few attempts with no success. Given normal search code:
template <class Type>
bool orderedLinkedList<Type>::search(const Type& searchItem) const {
bool found = false;
nodeType<Type> *current; //pointer to traverse the list
current = first; //start the search at the first node
[Code] .....
My attempt to make it a recursive search:
template <class Type>
bool orderedLinkedList<Type>::search(const Type& searchItem) const {
//bool found = false;
nodeType<Type> *current; //pointer to traverse the list
current = first; //start the search at the first node
[Code] ....
View 3 Replies
View Related
Aug 12, 2013
I've to use recursion function that return if the string has a same letters:
for example: - fff = true
- fFf = false
I did this but the return answer is always: NOT!
bool iSameLetters(char str[SIZE]) {
if(str[0]='