Home > Software engineering >  Vb stack overflow
Vb stack overflow

Time:09-18

 Function DZEBJZf (x) 
Dim b1, b2, b3, b4, bj1 As Double
B1=1.71
B2=1.56
Bj1=1.56
If b2 & lt; Bj1 & lt; B1 Then

DZEBJZf (x)=DZEBJZ1f (x) + (bj1 - b1) * (DZEBJZ2f (x) - DZEBJZ1f (x))/(b2, b1)


End the If
End the Function

Which DZEBJZ1f (x), DZEBJZ2f (x) has been defined, and there are no mistakes, when running the program in this section of the statement DZEBJZf (x)=DZEBJZ1f (x) + (bj1 - b1) * (DZEBJZ2f (x) - DZEBJZ1f (x))/(b2, b1) stack overflow error, that is why what to change, seek guidance!

CodePudding user response:

"Given a bit of input, a complete single-step tracking (and press Alt + 7 key to view the Call Stack from the inside to the following out of from the inner to outer function Call history) again," is your least-hassle route to understand the working principle of the recursive function!
Recursive function pay attention to the following factors
Exit criteria,
What parameters,
What, the return value is
What are local variables,
What are global variables,
When output,
, will not lead to stack overflow

CodePudding user response:

Logic problems, their own "thinking" is definitely wrong!
Your code - there are no "stack overflow", that is strange!


When you have the "function" is called:
Because the statement "If b2 & lt; Bj1 & lt; B1 Then "in" logical expression "is always True, and therefore can appear" function recursive calls ";
Because of the conditions of the end of the "recursive", has nothing to do with the incoming parameters, regardless of the number of parameters is are "will trigger the recursive calls",
In other words: this function as long as is called, will cause "infinite recursion call," is there not a "stack overflow" truth!!!!!!

CodePudding user response:

The return value of a function with the following form
 DZEBJZf=DZEBJZ1f (x) + (bj1 - b1) * (DZEBJZ2f (x) - DZEBJZ1f (x))/(b2, b1) 

CodePudding user response:

B1=1.71
B2=1.56
Bj1=1.56
If b2 & lt; Bj1 & lt; B1 Then

The three number is the same, that how to exit the recursion?

CodePudding user response:

Why are there aDo you want to understand the relationship between number of three, must use aWritten aAs well as a Boolean value & lt; C
Namely according to aIn vb, true=1, false=0
So judge conditions would eventually become 1 & lt; C or 0 & lt; c

CodePudding user response:

DZEBJZf (x) is a function expression, it is used to return a result, only as a value is assigned to a variable, and not think function assignment,
A (x) is the time to array elements can appear to the left of the equals sign

CodePudding user response:

A function that must be on all the branches can return results
Then
 if XXX'return results 
The else
'here also to return the results
End the if

CodePudding user response:

Questions of the method is wrong, ask what you want to aim directly, such as: what kind of input, want what kind of output, want to use recursive implementation do,
Don't you write a half into the dead end of code out and let others help you to change

CodePudding user response:

In general, the recursive or cycle call out problems are not meet the exit criteria.

CodePudding user response:

"Given a bit of input, a complete single-step tracking (at the same time to check the Call Stack from top to the following out of from the inner to the outer function Call history) again," is your least-hassle route to understand the working principle of the recursive function!
Recursive function pay attention to the following factors
Exit criteria,
What parameters,
What, the return value is
What are local variables,
What are global variables,
When output,
, will not lead to stack overflow

CodePudding user response:

BS above two dug grave...

CodePudding user response:

The
reference 11 floor Chen8013 response:
BS upstairs dig two graves...
with disdain,

CodePudding user response:

Learn the basic grammar to say again first

CodePudding user response:

Recursive calls you judge conditions are not clear, once in a recursive, has been called, no exports, recursive certainly overflow, do you must first clear export condition will be set up (If b2 & lt; Bj1 & lt; B1 Then) that is to say, if it has not set up? The recursion to three variables you have not been operation, namely three values have been the same, conditions or forever, or never set up, all the procedures or perform forever, or does not perform,
  • Related