Question: I'm just learning C, however I have played around with Ruby a lot in the past, and one thing you could do there was create a function that would allow you to pass in variable that could then be redefined in that function. In C however it appears that the function does not look at the variable, but instead what is stored in that variable. For example:

```
void add(int a, int b, int c);

int main(void)
{
    int num1 = 1, num2 = 1, num3;

    add(num1, num2, num3);
    printf("%d", num3);

}

void add(int a, int b, int c)
{
    c = a + b;
}

```

Simply returns an error stating that the variable num3 in undefined. So my question is, am I simply doing this incorrectly due to my lack of knowledge, and if so what is the correct way, or is this simply impossible in the C language?

Answer: 
I'll assume you are using Windows Forms, in which case you can implement this in the `TextChanged` event

Example:

```
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
    richTextBox2.Text = richTextBox1.Text;
}

```

But, that is not what you want to do... I would manipulate the string using `.Split()`

```
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
    string[] splitNewlines = richTextBox1.Text.Split('\n');
    string newText = "";
    foreach (string s in splitNewlines)
    {
        if (!string.IsNullOrWhiteSpace(s))
            newText += s + "." + "\n";
        else
            newText += "\n";
    }
    richTextBox2.Text = newText;
}

```

That will split the original string, add a period and a newline, and do this for every newline in the original text. Picture:

![working program](https://i.stack.imgur.com/OEKvo.png)
I assume u are adding this on some event. For example a button click, transfering some text from a textBox to your richtextbox.

U could try this:

```
this.richTextBox1.AppendText(textBox1.Text + "." + "\n"); 

```

This will add a dot at the end of the text, that it was in the textbox.