INCLUDE Irvine32.inc
.data
Message BYTE "Enter Number ",0
Arr DWORD 5 DUP(0)
Divi DWORD 4
GreaterNum DWORD 0
Outerloopholder DWORD 0
.code
main PROC
mov ecx, 1
mov eax, 0
.while(ecx<6)
mov edx, offset message
call WriteString
inc eax
call WriteInt
dec eax
call crlf
mov ebx, eax
call ReadInt
imul ebx, 4
mov Arr[ebx], eax
mov eax, ebx
sub edx, edx
div Divi
inc ecx
inc eax
.endw
mov ecx, 4
Greater:
imul ecx, 4
mov ebx, Arr[ecx]
mov eax, ecx
sub edx, edx
div Divi
mov Outerloopholder, eax
mov ecx, Outerloopholder
dec ecx
GreaterAgain:
imul ecx, 4
mov eax, Arr[ecx]
CMP ebx, eax
jl Changer
mov eax, ecx
sub edx, edx
div Divi
mov ecx, eax
loop GreaterAgain
Changer:
mov eax, Arr[ecx]
mov edx, eax
mov GreaterNum, edx
mov eax, ecx
sub edx, edx
div Divi
mov ecx, eax
loop GreaterAgain
mov ecx, Outerloopholder
loop Greater
mov eax, GreaterNum
call WriteInt
exit
main ENDP
END main
I am assigned to a task to take user input in an array and find the maximum but i couldn't do that because of the above error that says access violation of reading address