I know that similar question was asked but, I need some explanation: There is a code:
#include <stdio.h>
#include <stdlib.h>
int count_pieces(double *array){
int i = 0;
while(*(array + i)){
i++;
}
return i;
}
int main()
{
int i;
int n=1005;
double r[n];
for(i=0;i<n;i++){
*(r+i) = 100.0;
printf("%f\n", *(r+i));
}
printf("\n----------------------\n");
printf("N=%d",count_pieces(r));
printf("\n----------------------\n");
return 1;
}
count_pieces() was taken from know-all.net and was adapted for double. All works FINE. BUT! - when I comment line: printf("%f\n", *(r+i)); It becomes work incomprehensible! Why? What's happening?
double x; if (x == 0)will most likely fail if0was not assigned explicitly tox.