1. ## Pointer Questions

Can someone please tell me why rules is passing a warning from incompatible pointer type and why there is a Segmentation Fault in the second for loop (the one with the y)

Here is the code that actually pertains to my question, thanks in advance to all who help.

Code:
```fractalDraw(int depthFract, double angle, double iAngle, char *axiom, char **rules, double *x, double *y);

int main(){
double *x, *y;
bmp = bmp_create(300, 300, 32);
for(*x = 0; *x < 300; *x = *x + 1){
for(*y = 0; *y < 300; *y = *y + 1){
bmp_set_pixel(bmp, *x, *y, pixelB); //assume this works correctly (it does)
}
}

int numFract, i, depthFract, numRules, j, count = 0;
double angle, iAngle;
char axiom, rules, tbr, rhs;
scanf("%d", &numFract);
for(i = 0; i < numFract; i++){
scanf("%d", &depthFract);
scanf("%lf", &angle);
scanf("%lf", &iAngle);
scanf("%s", &axiom);
scanf("%d", &numRules);
for(j = 0; j < numRules; j++){
scanf("%s -> %s",&tbr,&rhs);
strcpy(rules[tbr],rhs);
}
}

fractalDraw(depthFract, angle, iAngle, axiom, rules, x, y);

bmp_save(bmp, "OUTPUT.BMP");
bmp_destroy(bmp);

return 0;
}``` 2. double *x, *y defines two pointers, pointing to doubles. You never allocated space for the doubles. And the pointers themselves have undefined values.
Then when you use *x in the loops, you are using some undefined address pointing to who knows where.
scanf("%s -> %s", tbr, rhs) <-- tbr and rhs must be char arrays. 3. Damn, I'm tired and I missed that, thank you. As for the tbr/rhs, rhs is a char array and for some reason if I tried %c with tbr (only one char will ever be entered in that spot), it won't work correctly :/. Any idea as for the incompatible pointer type question about the variable rules while it's in fractalDraw? 4. Oh you only want single character for tbr? Then use %c. But rhs is already an array so %s is OK there.
In the prototype for fractalDraw try char rules[]. The compiler needs to know how wide the array is. 5. I was unaware of that, thank you! Popular pages Recent additions arrays, double, pointers 