I have to define 1 structure

shaliwahan.patil's Avatar, Join Date: Dec 2007
Newbie Member
See the Problem:

C Programming
I have to define 1 structure

typedef struct
int roll;
char *name;

stud s1;

now for this rollno, and character pointer i have to enter value &store it in file, in this way store many records should be entered , &I should be able to add, modify, delete & display the records fromfile using same structure. memory leckage & dangalling pointer errorshould not come.

I have tried a lot but it is not working, so please see if you can help out.

but the thing is that it must be a character pointer only not acharacter array. is it possible???

Using character array I have done the same but not using pointer in CProgramming.

rest is ok..
Salem's Avatar, Join Date: Nov 2007
Ambitious contributor
Well if you've already managed to do this with a char array, then you're already half way.

When you have a pointer, it is all about making sure enough memory is allocated when you want to assign to that name, and that the memory is freed when you no longer need the structure.

Post some code, and don't forget to use [code][/code] tags.