Simple linked list implementation
I suggest using this declaration:

typedef struct _node {
  int val;
  struct _node *next;
} node;


After that, you can declare node *t instead of struct node *t. Also, you'll use sizeof(node) instead of sizeof(struct node).

Your delete is buggy. I'll quote just a bit:

struct node *deleteNode(struct node *first, int num)
{
  struct node *prev=NULL;
  struct node *root = first;
  while (root != NULL)
  {
    if (root-&gt;val == num)
    {
      ...
      else if (prev == NULL) //first element
      {
        free(first);
        first = root-&gt;next;
        root = root-&gt;next;
      }
      ...
    }
    ...
  }
  return first;
}


So, you have root = first, then you free the memory of first, and then you access root-&gt;next which is the same as first-&gt;next, which is a value contained in the already freed memory.

I'd write it in two parts:


Delete all there is to be deleted from the list start.
Delete all there is to be deleted, but is not at the list start.


Like this:

node *deleteNodes(node *first, int num) {
  node *prev, *active;

  while (first &amp;&amp; first-&gt;val == num) {
    node *tmp = first;
    first = first-&gt;next;
    free(tmp);
  }

  if (!first) return NULL;

  prev = first;
  active = first-&gt;next;

  while (active)
    if (active-&gt;val == num) {
      prev-&gt;next = active-&gt;next;
      free(active);
      active = prev-&gt;next;
    } else {
      prev = active;
      active = active-&gt;next;
    }

  return first;
}


I have changed the name of the function because you seem to want to remove all the nodes containing the value num.

A matter of personal choice: I prefer to transverse through a list the same way I do with arrays -- by using a for loop.

void printList(node *root) {
  node *t;
  for (t = root; t; t = t-&gt;next)
    printf("Value: %d\n", t-&gt;val);
}


If you really want to reuse root, you can, but one or few additional variables (like my t (stands for "temporary") in the above code) can make your code much more readable.

It may be useful to finish void functions with return;, as it helps you detect certain problems in code (i.e., if you change the return value to something else, such return will result in error and warn you to fix it).

This

node *current = malloc(sizeof(node));


can be written like this like this:

node *current = (node*)malloc(sizeof(node));


Read about using such a cast here and decide for yourself. I prefer to use it.

You should always release all your memory (i.e., delete the remaining list) when you program ends, instead of relying on the OS to do it properly.