View Single Post
Old 07-01-2006, 08:36 PM   #15 (permalink)
Manan
Registered User
 
Join Date: Jul 2005
Posts: 16
Manan is on a distinguished road
Its ok. I figured it out, thanks to help from my teacher. I can only use ({..}, {...}) that technique when initializing the matrices, and not for already initialized matrices. Therefore, I used the memcpy command. So basically:
Code:
int buffer[9][9];
if(randTemplate == 1)
	{ //If template 2 is chosen
	     int buffer2[9][9] = {

             {n[6],n[7],n[8], n[1],n[0],n[4], n[2],n[5],n[3] },
             {n[1],n[4],n[5], n[2],n[8],n[3], n[6],n[0],n[7] },
             {n[2],n[0],n[3], n[5],n[7],n[6], n[4],n[1],n[8] },

             {n[8],n[2],n[1], n[7],n[6],n[0], n[5],n[3],n[4] },
             {n[5],n[3],n[0], n[4],n[2],n[8], n[1],n[7],n[6] },
             {n[7],n[6],n[4], n[3],n[1],n[5], n[8],n[2],n[0] },

             {n[0],n[5],n[7], n[8],n[4],n[2], n[3],n[6],n[1] },
             {n[4],n[1],n[2], n[6],n[3],n[7], n[0],n[8],n[5] },
             {n[3],n[8],n[6], n[0],n[5],n[1], n[7],n[4],n[2] }
             };
             memcpy (buffer, buffer2, sizeof buffer);
      }
Manan is offline   Reply With Quote