我尝试了两个代码来删除主键,这里发布了我的两个代码。请帮助我。
for(int i = min; i <= max; i++){
int flag1 = 1, flag2 = 1; // This is the outer flag1
for(int j = 0; j < a_size; j++){
printf("In array a,value of %d mod %d is %d \n",i,a[j],i%a[j] );
if((i % a[j]) != 0){
int flag1 = 0; // This is the inner flag1
// The inner flag1 and the outer flag1 are different variables.
// The inner flag1 is set to zero, the outer flag1 is not changed.
printf("flag1 set to 0. Check flag1 = %d\n",flag1);
break;
}
// The brace ending the block ends the scope of the inner flag1.
// From now on the name flag1 refers to the outer flag1.
}