Hi.I have to create function that returns the next value in fibonachi sequence every time i call it.The argument of the function must be of bool type and by default is false.When I give true to the function it must reset the function to the begining fo the Fibonachi sequence .The result is not what I expect and I cannot debug (I dont know why) code to find out what the problem is.
Why did you use it?
int pfs[] = {...}; //this is none-static array of int, and...
static int* pi; //NONE-STATIC POINTER of static int
Then the fib() is calling, it makes pi = nullptr again-and-again;
And why are you assigning f with true and check it everytimes; //if(f = true) != if(f == true)
exru has a point, since the first time you call fib you pass false, the "corrected" program would increment pi (which has an undefined value) and then try to dereference it (segfault if you are lucky).
L B (8788) indeed! But i was seeing this mistake before. My specialization is php, but bugs is bugs independently of language. This is program needs refactoring before it will be start :)