Converting a character pointer to uppercase in C
<p>I have a pointer:</p>

<pre><code>char * name;
</code></pre>

<p>it contains the string <code>"test:case"</code></p>

<p>And I'm calling another function with it, and trying to store it in a structure. However, I want to capitalize the entire string first, but It doesn't seem to work. </p>

<pre><code>void func(char * name) {
    int i;
    List * l;

    l = malloc(sizeof(List));

    for(i=0; i&lt; strlen(name); i++) {
        name[i] = toupper(name[i]);
    }

    l-&gt;name = name;
    //CALL A FUNCTION TO LATER FREE ALLOCATED MEMORY
}
</code></pre>

<p>Where <code>List is a struct that has a member (char *) named name.</code>
This however, seg faults. I can't go about using non pointers in my case. As I have to use pointers and not character arrays, I'm trying to use toupper in every value of the char pointer, however this doesn't seem to work.</p>