 <p>This is very wrong. If you insist on not using <code>strcpy</code> do something like this (not tested)</p> <pre><code>int iStringLength = strlen(name); for (i = 0; i &lt; iStringLength; i++) { s-&gt;name[i] = name[i]; } </code></pre> <p>but make sure that the length is not longer than your array size. </p> <p>This is also wrong</p> <pre><code>Student* makeAndrew(void) { Student s; setName(&amp;s, "Andrew"); setStudentID(&amp;s, 12345678); return &amp;s; } </code></pre> <p>because the <code>s</code> object is destroyed when the function exits - it is local to the function scope and yet you return a pointer to it. So if you try to access the struct using this pointer it will not be valid as the instance no longer exists. If you want to do this you should dynamically allocate it using <code>malloc</code> . Alternatively do not return a pointer at all and use the alternative option of @Andrew .</p>