I am trying the following test case-
1
6 2
4 5 8 9 6 4
My compiler gives “yes” but ideone.com gives “no”…Why? I am using Dev C++ in my PC
I am trying the following test case-
1
6 2
4 5 8 9 6 4
My compiler gives “yes” but ideone.com gives “no”…Why? I am using Dev C++ in my PC
as far as i know there are two types of dev C++ one is bloodshed and the other one is orwell. bloodshed is not updating it where the orwell is updating and fixing bugs of the software. which one u are using?
i am using bloodshed…but as per the logic i’ve applied i should get yes.
umm the most confusing part is that even orwell’s devC++ will also have the bloodshed copyright in its about section. As u r using 5.6.2 it is fine. As @acodebreaker2 said above it may be due to different compiler version.
see these codes :-
C++ 4.3.2 ideone link gives yes.
C++ 4.8.1 ideone link gives no .
so the dev c++ may be using C++ 4.3.2 .
Thanx…but what compiler you are using…i mean did you checked the ideone code
Thank you very much…if i would have done it before then may be i would submit Sanskar answer
@apptica i ran ur code on my local machine that too in Devc++ version 4.8.1 and it gave me “yes”. TIP: Take care when initializing arrays as every machine donot initialize to zero.
In your code there are some paths in find function
int find(int a[],int n,int value)
Which don’t return any value. Whenever these paths are hit, you may get undefined result. This may give different result on different compilers or different version of compilers.
Fix: Make sure all paths return appropriate value.