Click here to Skip to main content
15,890,717 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DBGrid replacement? Pin
snavece14-Nov-13 3:09
snavece14-Nov-13 3:09 
SuggestionRe: DBGrid replacement? Pin
Richard MacCutchan14-Nov-13 6:07
mveRichard MacCutchan14-Nov-13 6:07 
QuestionCreate Window Region using CodeBlocks Pin
Luca D'Amico13-Nov-13 3:27
Luca D'Amico13-Nov-13 3:27 
SuggestionRe: Create Window Region using CodeBlocks Pin
Richard MacCutchan13-Nov-13 5:56
mveRichard MacCutchan13-Nov-13 5:56 
GeneralRe: Create Window Region using CodeBlocks Pin
Luca D'Amico15-Nov-13 4:05
Luca D'Amico15-Nov-13 4:05 
AnswerRe: Create Window Region using CodeBlocks Pin
Albert Holguin14-Nov-13 5:09
professionalAlbert Holguin14-Nov-13 5:09 
GeneralRe: Create Window Region using CodeBlocks Pin
Luca D'Amico15-Nov-13 3:48
Luca D'Amico15-Nov-13 3:48 
QuestionLinked List Error in C programming Pin
caulsonchua11-Nov-13 20:38
caulsonchua11-Nov-13 20:38 
Dear All,

i had write a code in C, but when execute, it an error.

May i know how to combine a correct structure ? kindly advise, thank you

Output results

**Enter integers: 23 12 34 56 78 12

Traversing the list : 23->12->34->56>78->12

Minimum value : 12

Reversing the list: 12->78->56->34->12->23**






#include <stdio.h> 
#include <stdlib.h>


   struct node
     {
    int data;
   struct node *next;
    }*head;



void insert_data(int value)
{
    struct node *var,*temp; 
    temp=head;
    var=(struct node *)malloc(sizeof(struct node));
    var->data=value;

    if(head==NULL)
    {
        head=var;
        head->next=NULL;
    }
   else
   {
        while(temp->next!=NULL)
         {
              temp=temp->next;
         }
         var->next=NULL;
         temp->next=var;
    }
}



void reverse_list()
{
    struct node *temp,*temp1,*var;
    temp=head;
    var=NULL;
    while(temp!=NULL)
    {
         temp1=var;
         var=temp;
         temp=temp->next;
         var->next=temp1;
    }
    head=var;
}



void display()
{
    struct node *var;
    var=head;
    printf("\nlist of elments are \n");

    while(var!=NULL)

    {
         printf(" %d ->",var->data);
         var=var->next;
    }
}




int main()
{
    int i,value;
    char ch='y';
    head=NULL;


         printf("\nEnter Integers: ");
         scanf("%d",&value);
         insert_data(value);
         display();


    }
getch();
 }

SuggestionRe: Linked List Error in C programming Pin
Richard MacCutchan11-Nov-13 22:41
mveRichard MacCutchan11-Nov-13 22:41 
AnswerRe: Linked List Error in C programming [updated, thanks David] Pin
CPallini12-Nov-13 3:50
mveCPallini12-Nov-13 3:50 
GeneralRe: Linked List Error in C programming Pin
David Crow13-Nov-13 4:08
David Crow13-Nov-13 4:08 
GeneralRe: Linked List Error in C programming Pin
CPallini13-Nov-13 5:10
mveCPallini13-Nov-13 5:10 
QuestionRe: Linked List Error in C programming Pin
David Crow13-Nov-13 4:06
David Crow13-Nov-13 4:06 
Questiontime performance -global or local Pin
econy11-Nov-13 16:57
econy11-Nov-13 16:57 
QuestionRe: time performance -global or local Pin
Richard MacCutchan11-Nov-13 22:39
mveRichard MacCutchan11-Nov-13 22:39 
AnswerRe: time performance -global or local Pin
econy12-Nov-13 4:05
econy12-Nov-13 4:05 
AnswerRe: time performance -global or local Pin
econy12-Nov-13 4:09
econy12-Nov-13 4:09 
GeneralRe: time performance -global or local Pin
Richard MacCutchan12-Nov-13 4:55
mveRichard MacCutchan12-Nov-13 4:55 
AnswerRe: time performance -global or local Pin
Aescleal12-Nov-13 8:10
Aescleal12-Nov-13 8:10 
GeneralRe: time performance -global or local Pin
econy12-Nov-13 8:37
econy12-Nov-13 8:37 
QuestionCMFCRibbonStatusBar Without a Border Pin
Paul Harrison 211-Nov-13 10:17
Paul Harrison 211-Nov-13 10:17 
QuestionConvert Raster image to vector geometry Pin
002comp11-Nov-13 1:35
002comp11-Nov-13 1:35 
AnswerRe: Convert Raster image to vector geometry Pin
Joe Woodbury11-Nov-13 6:03
professionalJoe Woodbury11-Nov-13 6:03 
GeneralRe: Convert Raster image to vector geometry Pin
002comp11-Nov-13 17:17
002comp11-Nov-13 17:17 
GeneralRe: Convert Raster image to vector geometry Pin
Joe Woodbury11-Nov-13 17:35
professionalJoe Woodbury11-Nov-13 17:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.