There is a example above but I still don't get it, it would be great if someone give me the final code so I can know what I'll get when I do it on my own.
always: read your code. Make sure that the snips do what they are supposed to.
Read the compiler messages
ex3.c:38:14: warning: ‘intArray2’ may be used uninitialized in this function [-Wuninitialized]
Once you fix that, run the program through a debugger http://www.cplusplus.com/articles/iwTbqMoL/
If you are lucky it will crash. Check out for undefined behaviour (like out of bounds access)
Compare the output for the test with the solution. Create more tests if needed.
Review your algorithm.
it would be great if someone give me the final code