Question: I'm working with a program written in C that involves comparing hypehenated surnames. For example, it might compare Mary Jay-Blige to Mary Kay-Blige.
The code that finds the hyphen and sets a variable to it's position is:

```
APT_String LAST_NAME
char * p_ich;
int iPosHyphen;
p_ich = strchr(LAST_NAME,'-');
iPosHyphen = p_ich-LAST_NAME+1;

```

where APT\_String is a data type for IBM's DataStage. 

I inherited the above code, and it appears to "work", but I would like some clarification on the `p_ich-LAST_NAME+1` operation. 
Namely, if `strchr()` returns the location of the first '-', how is C handling this arithmetic?

If I call `cout<<p_ich;`, I get `-Blige`. So I guess it returns the remainder of the string once the specified char is found?

Answer: 
You should have another method for the viewing aspect. Then submit your form against the "update" method. In there, you define the the form\_validation as you have now.

I asked a similar question. See this [link](https://stackoverflow.com/questions/2034002/codeigniter-form-validation-when-updating-records)
grab the data in update controller first for edit such as 

```
$query = $this->db->where('id',$id)->get('table_name');
$data['edit'] = $query->result_array();

```

and then check it in view file

```
  value="<?php if(isset($edit[0]['age'])){echo $edit[0]['age'];}else{echo set_value('age');}?>"

```