Besides the error mention in your question, you also have lots of other errors. For example:
arr1[i]=split1;
The variable split1
is a string, a pointer to char
, while arr1
is an array of int
.
To convert a string containing a number to an integer, you can use strtol
.
If that's not what you want, you need to make arr1
an array of strings, i.e. an array of pointer to char
:
char *arr1[8];
You also have a more serious error once you get the program to compile: Array indexes are zero based. That means that array indexes go from zero to the size minus one, or in the case of arr1
the indexes are from 0
to 7
(inclusive). Indexing an array out of bounds leads to undefined behavior.
Another case of undefined behavior is this line
printf("result=%s\n",arr1[i]);
Here you want to print a string, but provide an integer. This is not applicable if you change arr1
to an array of strings, of course.