Suppose if we have to print an array of integers line by line..with parameters as int size and int a[].
i,ve done d following thing but der r many errors in it!
int m,i,n;
struct node
{
int size,a[10];
struct node *next;
};
void main()
{
struct node *head=NULL,*temp;
clrscr();
printf("How many integers do u wanna enter?");
scanf("%d",&size);
printf("Enter the elements");
for(i=0;i<size;i++)
{
temp=(struct node*)malloc(sizeof(struct node));
scanf("%d",&temp->a[i]);
}
printf("The elements are %d",a[i]);
prob(*temp,a[]);
getch();
}
int prob(struct node *temp,int a[10])
{int size;
if(temp==NULL)
return a[0];
else
temp=a[0];
prob(temp->next,temp->a[i]);
printf("\n");
getch();
}
im not clear regarding the concepts of linked list and recursion.pls help.
Edited by WingedPanther, 03 March 2009 - 06:54 PM.
add code tags (the # button)


Sign In
Create Account

Back to top









