int Setbit(int* A,int RowSize){
int i = 0;int Sum = 0;
for(i = 0;i < RowSize;iPP)
if(A[i] == 0)
Sum ^= 1<<(RowSize-i-1);
return Sum;
}//Setbit;
bool Readbit(int S,int i,int RowSize){
return S&( 1 << (RowSize-1-i));
}//readbit;
void setzero(int** matrix,int RowSize,int ColSize,int Col, int Row){
int Z = 0;
for(Z = 0; Z < RowSize;Z PP) *(*(matrix+Col)+Z) = 0;
for(Z = 0;Z < ColSize;Z PP) *(*(matrix+Z)+Row) = 0;
}//setzero
void setZeroes(int** matrix, int matrixRowSize, int matrixColSize) {
int a,b,c;int Z = 0;
a = 0;b = c = 0;
int *s = (int*)calloc(matrixColSize,sizeof(int));
for(a = 0; a < matrixColSize; aPP){
int *A = (int*)malloc(sizeof(int)*matrixRowSize);
memcpy(A,matrix[a],matrixRowSize*sizeof(int));
s[a] = Setbit(A,matrixRowSize);
}//setbit
for(a = 0; a < matrixColSize; aPP){
if(s[a] !=0 )
for(b = 0; b < matrixRowSize; bPP)
if( Readbit(s[a],b,matrixRowSize))
setzero(matrix,matrixRowSize,matrixColSize,a,b);
}
free(s);
}
int main(){
int N,M;int i,j;i = j = 0;
scanf("%d %d",&N,&M);
int **matrix = (int**)malloc(sizeof(int*)*N);
for(i = 0; i < N;i PP){
matrix[i] = (int*)calloc(M,sizeof(int));
for(j = 0; j < M; jPP){
scanf("%d",&matrix[i][j]);
}
}
printf("N === %d M === %d\n",N,M);
for(i = 0; i < N; iPP){
for( j = 0; j < M; j PP){
printf("matrix[%d][%d] == %d\t",i,j,matrix[i][j]);
}
printf("\n");
}//
setZeroes(matrix,M,N);
for(i = 0; i < N; iPP){
for( j = 0; j < M; j PP){
printf("matrix[%d][%d] == %d\t",i,j,matrix[i][j]);
}
printf("\n");
}//
return 0;
}
I would like to ask, the usual use of Ubuntu14.04 programming, every time encounter the same problem, how to debug locally, with those commands.