Parameters by reference

Normally XCSB passes parameters by value. Sometimes however it is very useful to be able to pass parameters by reference. Parameters can be passed by reference by using pointers.
e.g.
	// function swap

	// on entry XA and XB pointer variables that refer
	// to 8 bit integer 'char' variables whose values
	// are to be swapped

	proc swap(char *XA, char *XB)

		char	temp

		temp = *XA
		*XA  = *XB
		*XB  = temp

	endproc


	// function swap_long

	// on entry XA and XB pointer variables that refer
	// to 32 bit integer 'long' variables whose values
	// are to be swapped

	proc swap_long(long *XA, long *XB)

		long	temp

		temp = *XA
		*XA  = *XB
		*XB  = temp

	endproc


	proc main()

		char	fred, bert
		long	jack, jill

		// NOTE: here we pass the addresses of
		// fred and bert (not their values) by
		// using the address of operator

		swap(& fred, & bert)

		// NOTE: here we pass the addresses of
		// jack and jill (not their values) by
		// using the address of operator

		swap_long(&jack, &jill)

	endproc
The pointer passing mechanism is not limited to passing refernces to variables, it can also be used to pass any pointer the function might need.