How to output a string in a marquee fashion?
<p>I want to be able to input a string (with spaces) and have it displayed like a moving sign. For example:</p>

<p>Input:</p>

<pre><code>Hello World!  
5   (This signifies the number of characters the sign can hold)  
</code></pre>

<p>Output:</p>

<pre><code>Sign #1:  
[Hello]  
[ello ]  
[llo W]  
[lo Wo]  
[o Wor]  
[ Worl]  
[World]  
[orld!]  
[rld! ]  
[ld! H]  
[d! He]  
[! Hel]  
</code></pre>

<p>This is what I have so far. If someone could direct me on what to do next I would greatly appreciate it! </p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;

int main() {
    int num_of_chars, i;
    char sign[30];
    char *arrayofsign = malloc(10 * sizeof(char));
    scanf("%[^\n]s", sign);
    arrayofsign = sign;
    printf("%s\n", arrayofsign);

    scanf("%d", &amp;num_of_chars);
    for (i = 0; i &lt; num_of_chars; i++) {
        printf("[]");
    }
}
</code></pre>