I'm struggling to implement in C a function that gets as two inputs , one input is an integer array, second input is the given sum.

the function returns the pairs of two element that its sum equal to the given sum.

I don't have much experience in C , and I started to implement the function by myself.

I've seen the solution here step by step :

how really we find the matched two pairs that its sum equal to the given sum?

For me a pseudo code is also awesome to understand the solution of the problem.

Much appreciated.