Code:

#include <stdio.h>
#define max_Size 19
#define max_pieces 10
void arrange(int width[], int height[], int size);
int check_full(int table[], int size);
void intial_table(int table[], int size);
int find_empty_cell(int table[], int size, int pos);
void structure_of_puzzle(int width_of_puzzle, int height_of_puzzle, int size);
void pieces(int height_of_puzzle,int width_of_puzzle,int width_of_piece,
int height_of_piece,int position);
void main() {
int width[max_pieces], // the array of the pieces' heights
height[max_pieces], // the array of the pieces' widths
i, // index
numH,numW,numP;//heights widths and number of pieces
printf("Enter puzzle height( < 20 ) width( < 20 ) number of pieces( <= 10 )\n");
scanf("%d%d%d",&numH,&numW,&numP);
printf("Enter array of size %d of piece heights:\n",numP);
for (i=0; i<numP; i++)
scanf("%d",&height[i]);
printf("Enter array of size %d of piece widths:\n",numP);
for (i=0; i<numP; i++)
scanf("%d",&width[i]);
arrange(width, height,numP);
for (i=0; i<numP; i++) printf("%3d", i);
putchar('\n');
for (i=0; i<numP; i++) printf("%3d", height[i]);
putchar('\n');
for (i=0; i<numP; i++) printf("%3d", width[i]);
putchar('\n');
pieces(numH,numW,width[0],height[0],0);
structure_of_puzzle(numH,numW,numH*numW);
}//main
void arrange(int width[], int height[], int size) { // arranges the arrays in descending fashion
int i, j, tmp1, tmp2;
for (i=0; i<size; i++) {
if (width[i]>height[i]) {
tmp1=width[i];
tmp2=height[i];
}//if width
else {
tmp1=height[i];
tmp2=width[i];
}//else
for (j=i; (tmp1*tmp2)>=(width[j-1]*height[j-1]) && j>0; j--) {
height[j]=height[j-1];
width[j]=width[j-1];
}//for j
width[j]=tmp1;
height[j]=tmp2;
}//for i
}//arrange
void intial_table(int table[], int size) {//gives initial value to all the array
int i;
for (i=0; i<size; i++) table[i]=-10;
}//intial_table
int check_full(int table[], int size) {//checks wether the array is full
int i; //index
for (i=0; i<size; i++)
if (table[i]==-10) return 0;
return 1;
}//check_full
int find_empty_cell(int table[], int size, int pos) {//finds and marks free cells
int i;
for (i=0; i<size && table[i]!=-10; i++);
return i;
}//find_empty_cell
void structure_of_puzzle(int height_of_puzzle, int width_of_puzzle, int size){//gives the dimantions of the puzzle
int row,col,index;
for(index=0;index<=size;index++){
row=index/width_of_puzzle;
col=index%width_of_puzzle;
}//for
}//structure_of_puzzle
void pieces(int height_of_puzzle,int width_of_puzzle,int width_of_piece[],
int height_of_piece[],int position){
int i,j;
for (i=0;i<=width_of_puzzle;i++)
for(j=0;j<=height_of_puzzle;j++);
}