Before I read either of your posts (I had left the house) a little mental brainstorming helped me to come up with this:
Code:
char name[20], value[20];
static int parseSetting(char* myString)
{
int i, array[1], i2 = 0, len = strlen(myString);
bool sep = false;
for(i = 0; i<len; i++){
if (myString[i] != ':') {
if(!sep){
name[i] = myString[i];
} else {
value[i2] = myString[i];
i2++;
}
} else {
sep = true;
}
}
name[i] = '\0';
value[i] = '\0';
array[0] = name;
array[1] = value;
return array;
}
parseSetting("howOld:20");
The bad thing is that it gives these warnings:
In function 'parseSetting':
warning: assignment makes integer from pointer without a cast
warning: assignment makes integer from pointer without a cast
warning: return makes integer from pointer without a cast
warning: function returns address of local variable
What's wrong?