This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Passing Data From C to Assembly



I've been trying to pass integers from a C program to an assembly program with no success. I've got it working with pointers though. Can anyone push me in the right direction? The working example with pointers is provided below. Also, the printf function doesn't print to console which is confusing as well. 

C file:

#include <stdio.h>

int* func(int*, int*, int*);

int main()
{
	int i = 12;
	int j = 13;
	int k = -5;

	int *p = func(&i,&j,&k);
	printf("%d\n", *p);

	return 0;
}

Assembly:

.text

		.def _func
_func	.cproc M, Y, Z

		.reg m
		.reg y
		.reg z
		.reg ans

		LDH *M,m
		LDH *Y,y
		LDH *Z,z

		ADD m, y, ans
		ADD ans, z, ans

		.return ans
		.endproc