>printf(head->data);
printf takes a string as the first argument, not an integer. You probably just forgot to add the format string, which would make the line look like this:
printf("%d\n", head->data);
If you don't mind, I'll make a few unrelated comments:
>#include<malloc.h>
malloc.h isn't a standard header, and it's certainly not the one you should be including for malloc. Include stdlib.h instead.
>main()
The best definition of main is:
int main ( void )
{
/* Your code here */
return 0;
}
This guarantees that you'll be able to compile now and in the forseeable future. Also, when you omit the return type, it's int. Just because you didn't say int explicitly doesn't mean you can omit the actual return value too.
>insert(node **head)
Once again, be sure to be explicit about your return types.
>newElem= (node *)malloc (sizeof(node));
This isn't built for maintenance. If you decide to change the name of the structure ("node" is surprisingly popular, and C doesn't handle naming conflicts very well), you have to change each and every occurrence of it in your code. You can get rid of the specific type entirely by doing this:
newElem = malloc ( sizeof *newElem );
The cast isn't required in C, and because sizeof doesn't evaluate the operand, you can dereference the pointer all you want and nothing bad will happen. The plus side is that this trick is an easy way of getting the size of the thing a pointer points to without knowing ahead of time.