0

Error: assignment makes integer from pointer without a cast
..i want to build an student database using linked list and in c language...but i am unable to create nodes for each variable like age,name,...i did not post the entire program but the concept is in the code...plzzz help..just tell me how should i bulid a student database using singly linked list

#include<stdio.h>
struct node
{
int data;
char value[20];
struct node *next;
};
typedef struct marksheet
{
int physics;
int chemistry;
int maths;
int biology;
int IP;
}mark;
typedef struct stu
{
char name[20];
int age;
int rollno;
char address[20];
char city[20];
int zipcode;
mark marks;
}students;
void create(struct node **,int);
void display() ;
students student[30];

int main()
{
struct node *p;
p=NULL;
int ch,n;
printf("\n\n\t****Welcome to Student database **********\n");
printf("1.Create an account\n2.Dsiplay the student accounts\n3.exit\n");
printf("\nPlease enter your choice:\n");
scanf("%d",&ch);
{
case 1:
printf("Enter the no of student Entry you wanna create:");
fflush(stdin);
scanf("%d",n);

create(&p,n);
break;
case 2:
display(&p);
break;
case 3:
exit(0);
break;
}
return(0);
}
void create(struct node **p,int n)
{
int i;
struct node *age;
struct node *name;
for(i=0;i<n;i++)
{
printf("\nEnter your name:");
scanf("%d",student[i].name);

name=(struct node*)malloc(sizeof(struct node));
name->data=student[i].name;
name->next=NULL;
printf("\nEnter your age:");
scanf("%d",&student[i].age);
age=(struct node*)malloc(sizeof(struct node));
age->data=student[i].age;
name->next=age;
age->next=NULL;
}
}
                                                                                                           78,1          75%

                                                                                                           1,1           To
void display(int n)
{
int i;
for(i=0;i<n;i++)
{
printf("name:%s",student[i].name);
printf("age:%d",student[i].age);
}}

Edited by Dani: Formatting fixed

4
Contributors
3
Replies
6
Views
9 Years
Discussion Span
Last Post by yellowSnow
0

First: Learn how to use codetags when posting code here. It makes your code easier to read.

Without reviewing all of your code, I did notice one problem:

....
scanf("%d",&ch);
{
case 1:
....

I suspect that you mean something like:

...
scanf("%d",&ch);
switch(ch);
{
case 1:
0

[
..i want to build an student database using linked list and in c language...but i am unable to create nodes for each variable like age,name,roll no,and also i have to implement in that the suboptions like modify ,search ,sort, create n display plz tell me how can i implement this one (a student database using singly linked list)

0

[
..i want to build an student database using linked list and in c language...but i am unable to create nodes for each variable like age,name,roll no,and also i have to implement in that the suboptions like modify ,search ,sort, create n display plz tell me how can i implement this one (a student database using singly linked list)

You obviously have a great deal to learn my friend.

First up, you've bumped an old thread.

After that, you have shown no effort that would even entice any of the talented members of this forum to help you out.

Read this:
http://www.daniweb.com/forums/announcement118-2.html

and try again.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.