Hiiiii :) iam new member from saudi arabia and i need help for my program in c language ,the out put dont perform the operation of linklist please help me :rolleyes:

please any one answer because the doctor discuss me on this program :-| :rolleyes: :-| :-|

Well I think there are some redundant white space characters you can get rid of for total unreadability :rolleyes:

For example, please reformat this

student *select(student *k)
{ int a;
printf("\n enter chosen");
scanf("%d",&a);
student *t=null;
t=k;
while(k!=null){
if((k->gpa)>a)
printf("\n (%d %s %f ",k->id,k->name,k->gpa);}
k=k->link;
 }

To look more like this

student *select(student *k) {
  int a;
  printf("\n enter chosen");
  scanf("%d",&a);

  student *t=null;    /*!! slipping into C++ mode here */
  t=k;
  while(k!=null) {
    if((k->gpa)>a) /*!! braces here would really make your meaning clear */
      printf("\n (%d %s %f ",k->id,k->name,k->gpa);
  } /*!! I think this brace is in the wrong place */
    /*!! That is, you want to step the list INSIDE the loop */
  k=k->link;

  /*!! You're supposed to return a student* here */
  /*!! but you just fall off the end of the function with nothing */
}

See, already I've spotting that one of your linked list routines will lock up simply by reformatting the code to indicate the flow of the program. And that's just one I picked at random.

This simple act of clearing up your code will no doubt throw up a lot of similar problems.

First off, there is little in your code which cannot be compiled with a C compiler, so the first question is, are you learning C or C++. I'm assuming that the .cpp extension to your filename is you just taking whatever the IDE prompts you with.

The random bits which need C++ I assume are there because your compiler didn't tell you at the time.

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.