x and y store solution of equation ax + by = g
int gcd ( int a , int b , int * x , int * y ) { if ( b == 0 ) { * x = 1 ; * y = 0 ; return a ; } int x1 , y1 ; int store_gcd = gcd ( b , a % b , & x1 , & y1 ) ;