#include<stdio.h>
#include<stdlib.h>


typedef struct a
{
	int data;
	struct a* next;
}node;
void addatbeg();
void delete();
void display();

node *first=NULL;

int main()
{
	int ch;
	
	while(1)
	{
	printf("\n1:to add elements \n2:to delete elements\n 3:to display elements");
	scanf("%d",&ch);
	
	switch(ch)
	{
		case 1:addatbeg();
				break;
		case 2:delete();
				break;
		case 3:display();
				break;
		default:printf("\n invalid option");
	}
	
}
}
void addatbeg()
{
	node *new;
	int ele;
	
	new=(node*)malloc(sizeof(node));
	new->next=first;
	first=new;
	printf("enter the element");
	scanf("%d",&ele);

	new->data=ele;
	
}


void display()
{
	node *temp;
	temp=first;
	while(temp!=NULL)
	{
		printf("%d->",temp->data);
		temp=temp->next;
	}
}
void delete()
{
	int pos,i;
	node *temp=first;
	node* prev=NULL;
	printf("\n enter the positon to delete");
	scanf("%d",&pos);
	if(pos==1)
		first=first->next;
	else
	{
	for(i=0;i<pos-1;i++)
	{	prev=temp;
		temp=temp->next;
	}
	prev->next=temp->next;
}
}

when i run the above program in pelles c i get the following messages:

C:\Documents and Settings\Administrator\My Documents\Pelles C Projects\array\main.c(39): warning #2027: Missing prototype for 'addatbeg'.
C:\Documents and Settings\Administrator\My Documents\Pelles C Projects\array\main.c(55): warning #2027: Missing prototype for 'display'.
C:\Documents and Settings\Administrator\My Documents\Pelles C Projects\array\main.c(65): warning #2027: Missing prototype for 'delete'.

but all prototypes are included at the beginning.

Technically those aren't prototypes, they're old style declarations. To be proper prototypes you need to specify the parameter list (void if there are no parameters):

void addatbeg(void);
void delete(void);
void display(void);

My educated guess is that's your problem. What compiler are you using?

Technically those aren't prototypes, they're old style declarations. To be proper prototypes you need to specify the parameter list (void if there are no parameters):

void addatbeg(void);
void delete(void);
void display(void);

My educated guess is that's your problem. What compiler are you using?

thanku for that friend.
now there are no warnings.
but the statements without the parameter list does not give an error in turbo c or in dev c.
i got this error in pelles c.

This article has been dead for over six months. Start a new discussion instead.