I am trying to pass an array to my sorting program written in assembly. The code i have so far is:
main.c:
#include <stdio.h>
extern void myFunc(int * somedata);
int arr[5] = { 3, 2, 33, 11, 1};
void main(){
int i;
myFunc(arr);
for(i = 0; i < 5; i++)
{
// printf( "%d\n", arr[i] );
}
}
myFunc.asm:
section .text global myFunc extern printf
myFunc:
enter 4,0
push ebx
push dword [ebp + 8]
call printf
pop ebx
leave
ret
This is just some testing code to get learn how to do this.
My understanding would be that this should print the pointer to the array but I'm probably wrong.
Can anyone give me a simple example of passing an array to an assembly file (NASM).
Thank you!
push "%x\n"onto the stack as well?