Creating Linked List dynamically in C <p>I'm trying to create a linked list dynamically in <code>c</code> using structures and print it. But my below code is throwing runtime error can anybody tell me why I am getting this error. Here is my code.</p> <pre><code>#include &lt;stdio.h&gt; struct cnode { int value; struct cnode *next; }; void print_list(struct cnode* start) { while(start-&gt;next != NULL) { printf("%d-&gt;", start-&gt;value); start = start-&gt;next; } } int main(void) { int i,n,val; //List length scanf("%d", &amp;n); //Head struct cnode* start; scanf("%d", &amp;val); start-&gt;value = val; struct cnode* temp = start; for (i=1; i&lt;=n-1; i++) { struct cnode* node; scanf("%d", &amp;val); node-&gt;value = val; temp-&gt;next = node; temp = node; } temp-&gt;next = NULL; print_list(start); return 0; } </code></pre>