CPallini is right, so ordering could improve the speed of your loop because your can stop the looping when the diff gets greater than num. Think about dropping some comparison if the numbers are smaller than num. Maybe only if alway greater than zero.
If you need to find the numbers you also must store them for output.
if (abs(a[i] - b[j]) == num)
{
result1 = a[i]; result2 = b[i];
return 1;
}
What about multiple solutions in the array?
But speed isnt the primary problem on that simple task. Such "optimization" often leads to complex and bizarre code which results in strange bugs and problems.
So anything you missed to mention?