Difference between character and character array

After reading all references on character arrays and strings I'm still confused as to the differences between:

character

character - array

character - string

Basically I want to pull a whole line from ethernet client, however right now I'm doing this over serial port, then process it and place values from string into variables.

Using advice from this forum, I've achieved taking the line of code I'm trying to process and filtering out what I need, however, I don't know how to properly read from the serial and place the value into a form that can be used by the code below: (instring is the line that will be sent from the client)

char instring [] = "$:7, 120, 0, 1";  //input string                                                
char delimiters[] = "$:,";          // characters to skip over
char* valPosition;                // array
int angle[] = {0, 0, 0, 0};          // array to hold integer values after processing


// initializes strtok with our string to tokenize

valPosition = strtok(instring, delimiters);


for (int i= 0; i<4; i++){
  angle[i] = atoi(valPosition);          // place values from string into buffer and convert characters into integer files
  Serial.println(angle[i]);
  
  
  // here we pass null which tells strtok to continue working with the previous string
  valPosition = strtok(NULL, delimiters);

I've been able to pull values from the serial, however, not in a form that can be manipulated and filtered using the strtok() command which is char x[] = "";

I'm looking for a way to pull a whole line from ethernet or serial and then place it in the code above to have it filter out commas, and convert the values into integers.

The code I'm using to get strings from serial is:

char string[32];
char byteRead;

while (Serial.available()==0){}

int c = Serial.available();

for ( int i = 0; i < c; i++){
  // ENTER CODE TO PLACE VALUES IN ARRAY HERE
  string[i] = Serial.read();
  string[i+1] = '\0';               //Append a null
  
}
Serial.write(string);

Any help would be greatly appreciated. Thanks very much.

I don't know how to properly read from the serial and place the value into a form that can be used by the code below

The information you need is in Robin2's excellent tutorial on Serial Input Basics.
http://forum.arduino.cc/index.php?topic=288234.0

char* valPosition;                // array

That most certainly is NOT an array. It is a pointer that MIGHT point to the start of an array (but currently points to garbage).

You're pretty close to the solution. Study this:

#define ARRAYELEMENTS(x) (sizeof(x) / sizeof(x[0]))

char instring [] = "$:7, 120, 0, 1";  //input string
char delimiters[] = "$:,";          // characters to skip over
char* valPosition;                // array
char temp[10];
int angle[] = {0, 0, 0, 0};          // array to hold integer values after processing


void setup() {
  int i;
  
  Serial.begin(9600);

  valPosition = strtok(instring, delimiters);
  i = 0;
  while (valPosition != '\0') {
    strcpy(temp, valPosition);
    angle[i++] = atoi(temp);
    valPosition = strtok('\0', delimiters);
  }

  for (i = 0; i < ARRAYELEMENTS(angle); i++) {
    Serial.println(angle[i]);
  }
}

void loop() {
}

and explain to yourself what each statement does.

Thanks everyone!

The Serial input basics tutorial helped me a lot.

Hahahha okay char* valPosition is a pointer, I am still confused as to the differences between the various use of char and I appreciated you telling me things like this.

EJ, thanks a lot, I'll write it out and comment what each line does, and I hope that solidifies my understanding.

Thanks again everyone.

A char is 8 bits of memory that as a number can be -128 to 127, it can be used as ASCII text.

Look up ascii table, every programming text/reference had one in the front or back for easy use.

A byte is an unsigned char.

A single dimension char array is a series of char variables that you can address by index number.

A char pointer holds a memory address for a char. You can change it to point to another char by adding to or subtracting from the pointer. Set the pointer at the first and read that then ++ the pointer takes you to the next, you can process an array in a loop under one name for many values. Without that, every variable has to have a unique name and code that names it... a mess.

When you make an array you give it a name. That name is a pointer to the start of the array.

A C string is a char array with chars for use as ASCII and a char == 0 to mark the end of text.
Make your arrays big enough to handle any changes you will put them through. Do not write past the end of an array!