void init(bool A[MAX][MAX],bool res[MAX][MAX]){
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
res[i][j] = A[i][j] = 0;
/**
memset(res,0,sizeof(res));
memset(A,0,sizeof(A));
**/
for(int i=0;i<n;i++)
A[P[i]][i] = 1,res[i][i] = 1;
}
Here is the code snippet. If i used the commented part instead of two loops it fails and produce a weird output.
here is the full code link and problem link. http://ideone.com/cdsWYE http://www.spoj.com/problems/PDECODE/
Please if anyone can help then suggest me a valid reason for this.
http://c-faq.com/aryptr/aryparmsize.html
Thank you so much
replace
with
This will not make nay difference because arrays are always passes by pointers / references .
I am so sorry i got the idea behind your comment.
I don't understand. What exactly does it do?