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);
}}

Recommended Answers

All 3 Replies

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:

[
..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)

[
..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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.