We already written a program for the two's complement using C-Programming. This program is a combination of many user defined functions. This flow chart is also drawn using functions. Many of us not so clear about drawing flow charts for the functions. So the complete solution is in these flow charts.

flowchart-2s complement1-programming9

And another function with Compl(binary,a) can be written as

flowchart-2s complement2-function-programming9