out of array index? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

out of array index?

https://code.sololearn.com/cq4xACSzkEId/?ref=app whay this happened?(whay arr[2] is anonymous Integer?) and other question is: is there runtime error in c++?

16th Apr 2021, 8:21 PM
Mehran
Mehran - avatar
10 Answers
+ 2
Martin Taylor thanks it was useful for me.
17th Apr 2021, 11:51 AM
Mehran
Mehran - avatar
+ 1
David Dolejší Can pointers access to any place of memory?
16th Apr 2021, 8:28 PM
Mehran
Mehran - avatar
+ 1
David Dolejší wich apps stored that Integer on this index?
16th Apr 2021, 8:34 PM
Mehran
Mehran - avatar
+ 1
David Dolejší i I realized that one index after array length is always zero. (test code) why?
16th Apr 2021, 8:41 PM
Mehran
Mehran - avatar
+ 1
Martin Taylor are you see my code? i know character array end by null. my code: int arr[]={2,1}; cout<<arr[2]<<endl;//Same as *(a+2). result is anonymous Integer and arr[3] is 0 or 1 depends on compiler that i check. why?
16th Apr 2021, 10:42 PM
Mehran
Mehran - avatar
+ 1
Martin Taylor answer another my question about c++ (see my activity)
16th Apr 2021, 10:44 PM
Mehran
Mehran - avatar
+ 1
Martin Taylor it is my another question : using c++ language? i love c/c++ because it is very self-description(concepts describe themselves with computer architecture) and powerful. But it no longer has much use in the world, in Windows c#(Microsoft offers c#) is used on Android java, and on the web the client uses JavaScripit and etc, If I learn it, I will forget it because I have no use. What your offer? when I mention you, are you get notification?
16th Apr 2021, 11:29 PM
Mehran
Mehran - avatar
+ 1
ok it is beautiful. second variable use memory cell after array because that declared after it.
16th Apr 2021, 11:39 PM
Mehran
Mehran - avatar
+ 1
Martin Taylor change code with it int arr[] ={1,2}; int a=3 int b=4; cout <<arr[2]<<endl ; cout <<arr[3]<<endl ; //result is 4, 3 why? are data transfer in memory?
16th Apr 2021, 11:50 PM
Mehran
Mehran - avatar
+ 1
these tests depend on compiler.
17th Apr 2021, 12:53 AM
Mehran
Mehran - avatar