i have a problem in separating the data ...

i have a problem in separating the data send by the pc and assigned those data data in different variable here's my code..

char c[30];
String getValue(String data, char separator, int index);

void setup()
{
  Serial.begin(9600);
}

void loop(){
  if (Serial.available()){
  c[30]=Serial.read();
 
  delay(50);
  Serial.println(c[30]);
  delay(50);
String cpNum = getValue(c[30], ' ', 0);
String logTime = getValue(c[30],' ',1);

Serial.println(cpNum);
delay(5);
Serial.println(logTime);
  }
}

String getValue(String data, char separator, int index)
{
  int found = 0;
  int strIndex[] = {0, -1};
  int maxIndex = data.length()-1;

  for(int i=0; i<=maxIndex && found<=index; i++){
    if(data.charAt(i)==separator || i==maxIndex){
        found++;
        strIndex[0] = strIndex[1]+1;
        strIndex[1] = (i == maxIndex) ? i+1 : i;
    }
  }

  return found>index ? data.substring(strIndex[0], strIndex[1]) : "";
}

here's my error

sketch_feb27a.ino: In function 'void loop()':
sketch_feb27a:16: error: invalid conversion from 'char' to 'const char*'
sketch_feb27a:16: error: initializing argument 1 of 'String::String(const char*)'
sketch_feb27a:17: error: invalid conversion from 'char' to 'const char*'
sketch_feb27a:17: error: initializing argument 1 of 'String::String(const char*)'
]

Moderator edit: code tags corrected (I hope) AWOL.

Why is your text inside the code tags? It isn't code.

  c[30]=Serial.read();

Where is c declared?

String cpNum = getValue(c[30], ' ', 0);

c[30] is not a String, so it is the wrong thing to be passing to this class.

Learn to NOT use the String class.

wat I need to used??pls help me..

wat I need to used??pls help me..

c is an array that contain 30 values.

c[30] is a memory location that is just beyond the end of the array that will be interpreted as a character.

String cpNum = getValue(c[30], ' ', 0);

You want to pass the whole array to this function, not some junk just past the end of the array:

String cpNum = getValue(c, ' ', 0);

hah???i dont really understand

I think the IDE has some examples of array handling - it might be worth your while working through some of them to help understand what's going on.