My C code
#include <stdio.h>
#include <stdlib.h>
#include "help.h"
int test(int x, P *ut) {
int point = 10;
ut->dt[10].max_x = NULL;
}
int main(int argc, char** argv) {
return (EXIT_SUCCESS);
}
my help.h file code
typedef struct{
double max_x;
double max_y;
}X;
typedef struct{
X dt[10];
}P;
I got an error i.e
error: incompatible types in assignment
error comes in here
ut->dt[10].max_x = NULL;
can anybody help me.
thanks in advance.
You are trying to set a double value to
NULL, which even if compiles, is mixing two incompatible terms. (In some versions of the C class libraryNULLis defined simply as0, in others as(void*)0– in latter case you get an error for such code.)Moreover, you try to access index 10 of an array of size 10, which is out of bounds – the elements are indexed from 0 to 9. So try this: