Hi Edward,
Yes your right, I am using a character array, not character string. Im in process of wrapping my head around the array manipulation, so I mistakenly call arrays of characters as strings. I will start paying more attention to that. Thank you for the input and the code example. Could you provide the same but for the manipulation of the array. It seems my code would work with the changes suggested. I will try that. Thank you...
User Profile
Collapse
-
ahh ok that works. So something like
unsigned char string_raray[] = {10,100,10,120, 100,10};
int a,b,counter;
a = 0;
c = string_array[a]
for (b=0;b < strlen(string_a rray);b++)
{
if (c == ",") {
conter++
}
};
int finalcount = counter +1Leave a comment:
-
Function to determine how many items in a string
Hi everyone,
I'm new to C programming and trying to do something.
I have a character string. Its just numbers delimited by a comma.
Example.
unsigned char string[] = {1,2,3,4,5,6};
I need to count how many items there are. This is for a function that needs to know how many items its getting. There are more strings so Its not a fixed value. And I can't just use a maximum...
No activity results to display
Show More
Leave a comment: