- 1
Arrays are easy
//C++ #include< iostream> using namespace std; int main() { int A[4] {0,1,5}; cout<<A[3] ; cout<<A[4] ; cout<<A; return 0; } find following without WAP 1>>cout<<A[3] ; 2>>cout<<A[4]; 3>>//Output of cout<<A; Explain ur answer
17 Réponses
+ 12
arr[4] causes array index out of bound error, results in undefined behaviour, in your case - Garbage values, which is whatever was left behind in the memory block.
An array of size 4 has index 0, 1, 2 and 3 only.
+ 5
Am I dumb or does this make no sense
+ 5
code is wrong
+ 4
sure here you go :D
+ 3
gg with the challenge
And I do not understand, what you mean.
Your code did not have values for [3] [4] you printed errors
+ 3
What is WAP?
+ 3
Do you understand arrays?
Your code gives out of index errors.
+ 3
Pls upvote
😞
+ 2
rest arr[3] =0 as it has been allocated a blank space for array but has not been assigned so default is 0.
+ 2
And cout<<A; gives memory address of A[0] u may verify by cout<<&A[0];
0
Hey i have nt written the complete code do u want me to include library and all that
0
U may check now this in C++ see it works but i want a ans without WAP.
0
Pls upvote if u learned something from it.
0
Writing A Programme
0
U may check the attached code see it results in a output i don't want to explain what is it let someone else explain
😊pls upvote