In lines 359 and 360 i have this piece of code:

 printf("Oi mathites me ton megalytero bathmo ( %f  )  einai oi: \n",max);
      for (i=Stack.Top;i>=0;i--) {

        printf("%f, \n",Stack.Element[i]);
    }

And i want to print the results of that Stack...... but nothing happens .. :-/ What have i missed to add again ??

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define NumberOfNodes 5   
#define StackLimit 6 
#define NilValue 0          // åéäéêÞ ìåäåíéêç ôéìç äåß÷íåé ôï ôÝëïò ôçò Óõíä.ëßóôáò

typedef struct
{
   int am;
   float ba8; 


}ListElementType;

typedef int ListPointer;

typedef struct {
    ListElementType Data;
    ListPointer  Next;
} NodeType;

typedef enum {
    FALSE, TRUE
} boolean;






typedef float StackElementType;   // ï ôýðïò ôùí óôïé÷åßùí  ôçò óôïßâáò
                                //åíäåéêôéêÜ ôýðïò int 
typedef struct  {
    int Top;
    StackElementType Element[StackLimit];
} StackType;





void Push(StackType *Stack, StackElementType Item); 
void FindMax(NodeType Node[],ListPointer List,StackType Stack);
void CreateStack(StackType *Stack);
boolean FullStack(StackType Stack); 
//===================================================
void InitializeStoragePool(NodeType Node[], ListPointer *FreePtr);
void CreateLList(ListPointer *List);
boolean EmptyLList(ListPointer List);
boolean FullLList(ListPointer FreePtr);
void GetNode(ListPointer *P, ListPointer *FreePtr, NodeType Node[]);
void ReleaseNode(NodeType Node[NumberOfNodes], ListPointer P, ListPointer *FreePtr);
void Insert(ListPointer *List, NodeType Node[],ListPointer *FreePtr, ListPointer PredPtr, ListElementType Item);
void Delete(ListPointer *List, NodeType Node[], ListPointer *FreePtr, ListPointer PredPtr);
void TraverseLinked(ListPointer List, NodeType Node[]);
void menu(int *choice);
void printAll(ListPointer List, ListPointer FreePtr, NodeType Node[]);

main()
{
    ListPointer AList;
    NodeType Node[NumberOfNodes+1];
    ListPointer FreePtr,PredPtr;
    StackType Stack;

    ListElementType AnItem;

   int choice, i;
   char ch;
//===============================================
   InitializeStoragePool(Node, &FreePtr);
   printAll(AList, FreePtr, Node);
//===============================================   

   do
   {
    menu(&choice);
      switch(choice)
      {
          case 1: CreateLList(&AList);          //DHMIOYRGIA LISTAS
                     break;
          case 2:   do
                    {
                        printf("FreePtr=%d\n",FreePtr);
                        printf("DWSE ARI8MO MHTRWOY: ");
                        fflush(stdin);
                        scanf("%d", &AnItem.am);
                        printf("\nDWSE BATHMO MATHITI: ");
                        fflush(stdin);
                        scanf("%f",&AnItem.ba8);
                        /*H EISAGWGH STOIXEIOY GINETAI PANTA STHN ARXH THS LISTAS (STO PX SYMPERIFERETAI WS STOIBA)
                        * SE PERIPTWSH POY 8ELW PX  TAXINOMHMENH LISTA 8A PREPEI NA YLOPOIHSW EPIPLEON SYNARTHSH SEARCH
                        * POY 8A EPISTREFEI TH TIMH THS PredPtr
                        */

                        PredPtr=NilValue;
                        Insert(&AList, Node,&FreePtr, PredPtr, AnItem); //EISAGWGH STOIXEIOY META TH 8ESH POS STH LISTA    
                        printf("AList=%d\n",AList);
                        printf("\nContinue Y/N: ");
                        do
                        {
                             scanf("%c", &ch);
                        } while (toupper(ch)!= 'N' && toupper(ch)!= 'Y');
                    } while (toupper(ch)!='N');
                    printAll(AList, FreePtr, Node);
                    break;
          case 3:   printf("FreePtr=%d\n",FreePtr);
                    TraverseLinked(AList, Node);      //DIASXISH LISTAS
                    break;
          case 4:   if (EmptyLList(AList))
                         printf("Empty List\n");
                    else  
                    {
                        printAll(AList, FreePtr, Node); 
                        printf("DWSE TH 8ESH TOY PROHGOYMENO STOIXEIOY GIA DIAGRAFH: ");
                        scanf("%d", &PredPtr);
                        Delete(&AList, Node, &FreePtr, PredPtr);  //DIAGRAFH STOIXEIOY META TH 8ESH POS STH LISTA      
                        printAll(AList, FreePtr, Node);
                    }
                    break; 
          case 5:   if (EmptyLList(AList))
                         printf("Empty List\n");
                    else printf("Not an Empty List\n");
                    break;
        case 6:   if (FullLList(FreePtr))
                         printf("Full List\n");
                    else printf("Not a Full List\n");
                    break;
         case 7:    printAll(AList, FreePtr, Node);     //EMFANISH STORAGE POOL
                    break;


        case 8: CreateStack(&Stack); 
            FindMax(Node,AList,Stack);
      }
   } while (choice!=9);

    return 0;
}

void menu(int *choice)
{
    printf("                  MENOY                  \n");
    printf("-------------------------------------------------\n");
    printf("1. Create List\n");
    printf("2. Insert an element to List\n");
    printf("3. Traverse List\n");
    printf("4. Delete an element from the List\n");
    printf("5. Check if List is empty\n");
    printf("6. Check if List is full\n");
    printf("7. Print storage pool\n");
    printf("8. FindMax\n");
    printf("9. Exit\n ");
    printf("\nChoice 1-9 : ");
    do
    {
        scanf("%d", &(*choice));
    } while (*choice<1 && *choice>8);
}

void printAll(ListPointer List, ListPointer FreePtr, NodeType Node[])
{
    int i;
    printf("1o STOIXEIO LISTAS=%d, 1H FREE POSITION=%d\n", List, FreePtr); 
    printf("H STORAGE POOL EXEI TA EJHS STOIXEIA\n");
    for (i=1;i<=NumberOfNodes;i++)
        printf("(%d, %d, %f, %d) \n",i,Node[i].Data.am,Node[i].Data.ba8, Node[i].Next);
    printf("\n");
}

void InitializeStoragePool(NodeType Node[], ListPointer *FreePtr)
/* ÄÝ÷åôáé:   Ôïí ðßíáêá Node êáé ôïí äåßêôç FreePtr ðïõ äåß÷íåé óôïí 
                ðñþôï äéáèÝóéìï êüìâï. 
  Ëåéôïõñãßá: Áñ÷éêïðïéåß ôïí ðßíáêá Node ùò óõíäåäåìÝíç ëßóôá óõíäÝïíôáò ìåôáîý 
                ôïõò äéáäï÷éêÝò åããñáöÝò ôïõ ðßíáêá, 
                êáé áñ÷éêïðïéåß ôïí äåßêôç FreePtr . 
  ÅðéóôñÝöåé: Ôïí ôñïðïðïéçìÝíï ðßíáêá Node êáé ôïí 
                äåßêôç FreePtr ôïõ ðñþôïõ äéáèÝóéìïõ êüìâïõ 
*/
{
   int i;

    for (i=1; i<NumberOfNodes;i++)
    {
        Node[i].Next=i+1;
        Node[i].Data.am=-1;
        Node[i].Data.ba8=-1.0;
    }
    Node[NumberOfNodes].Next=0;
    Node[NumberOfNodes].Data.am=0;
    Node[NumberOfNodes].Data.ba8=0.0;
    *FreePtr=1;
}

void CreateLList(ListPointer *List)
/* Ëåéôïõñãßá: Äçìéïõñãåß ìéá êåíÞ óõíäåäåìÝíç ëßóôá. 
   ÅðéóôñÝöåé: ¸íáí (ìçäåíéêü) äåßêôç ðïõ äåß÷íåé óå êåíÞ ëßóôá  
*/
{
  *List=NilValue;
}

boolean EmptyLList(ListPointer List)
/* ÄÝ÷åôáé:    ¸íáí äåßêôç List ðïõ äåß÷íåé óå ìéá óõíäåäåìÝíç ëßóôá. 
   Ëåéôïõñãßá: ÅëÝã÷åé áí ç óõíäåäåìÝíç ëßóôá åßíáé êåíÞ. 
   ÅðéóôñÝöåé: True áí ç óõíäåäåìÝíç ëßóôá åßíáé êåíÞ êáé false äéáöïñåôéêÜ 
*/
{
  return (List==NilValue);
}

boolean FullLList(ListPointer FreePtr)
/* ÄÝ÷åôáé:    Ìéá óõíäåäåìÝíç ëßóôá. 
   Ëåéôïõñãßá: ÅëÝã÷åé áí ç óõíäåäåìÝíç ëßóôá åßíáé ãåìÜôç. 
   ÅðéóôñÝöåé: True áí ç óõíäåäåìÝíçëßóôá åßíáé ãåìÜôç, false äéáöïñåôéêÜ 
*/
{
  return (FreePtr == NilValue);
}

void GetNode(ListPointer *P, ListPointer *FreePtr, NodeType Node[])
/* ÄÝ÷åôáé:   Ôïí ðßíáêá Node êáé ôïí äåßêôç FreePtr. 
  Ëåéôïõñãßá: ÁðïêôÜ Ýíáí "åëåýèåñï" êüìâï ðïõ ôïí äåß÷íåé ï äåßêôçò P. 
  ÅðéóôñÝöåé: Ôïí äåßêôç P êáé ôïí ôñïðïðïéçìÝíï  äåßêôç FreePtr 
                ðïõ äåéêôïäïôåß óôï ðñþôï äéáèÝóéìï êüìâï              
*/               
{
  *P = *FreePtr;
  if (*FreePtr!=0) 
    *FreePtr =Node[*FreePtr].Next;
}

void ReleaseNode(NodeType Node[], ListPointer P, ListPointer *FreePtr)
/* ÄÝ÷åôáé:    Ôïí ðßíáêá Node, ðïõ áíáðáñéóôÜ ôç äåîáìåíÞ ôùí äéáèÝóéìùí êüìâùí, 
                Ýíáí äåßêôç TempPtr êáé ôïí äåßêôç FreePtr. 
   Ëåéôïõñãßá: ÅðéóôñÝöåé óôç äåîáìåíÞ ôïí êüìâï óôïí ïðïßï äåß÷íåé ï TempPtr. 
   ÅðéóôñÝöåé: Ôïí ôñïðïðïéçìÝíï ðßíáêá Node êáé ôïí äåßêôç FreePtr 
*/
{
  Node[P].Next =*FreePtr;
  Node[P].Data.am = -2;   
  Node[P].Data.ba8=-2;

  /* Ï÷é áíáãêáßá åíôïëÞ, âïçèçôéêÞ ãéá íá öáßíïíôáé óôçí 
                           åêôýðùóç ïé äéáãñáììÝíïé êüìâïé */
  *FreePtr =P;          
}

void Insert(ListPointer *List, NodeType Node[],ListPointer *FreePtr, ListPointer PredPtr, ListElementType Item)
/* ÄÝ÷åôáé:    Ìéá óõíäåäåìÝíç ëßóôá, ôïí ðßíáêá Node, ôïí äåßêôç PredPtr êáé 
                Ýíá óôïé÷åßï Item. 
  Ëåéôïõñãßá: ÅéóÜãåé óôç óõíäåäåìÝíç ëßóôá, áí äåí åßíáé ãåìÜôç, ôï óôïé÷åßï 
                Item ìåôÜ áðü ôïí êüìâï óôïí ïðïßï äåß÷íåé ï äåßêôçò PredPtr.  
  ÅðéóôñÝöåé: Ôçí ôñïðïðïéçìÝíç óõíäåäåìÝíç ëßóôá, ôïí ôñïðïðïéçìÝíï ðßíáêá Node 
                êáé ôïí äåßêôç FreePtr. 
  Åîïäïò:     ÌÞíõìá ãåìÜôçò ëßóôáò, áí ç óõíäåäåìÝíç ëßóôá åßíáé ãåìÜôç 
*/
{
  ListPointer TempPtr;
  GetNode(&TempPtr,FreePtr,Node);
  if (!FullLList(TempPtr)) {
    if (PredPtr==NilValue)
    {
        Node[TempPtr].Data =Item;
        Node[TempPtr].Next =*List;
        *List =TempPtr;
    }
    else
      {
        Node[TempPtr].Data =Item;
        Node[TempPtr].Next =Node[PredPtr].Next;
        Node[PredPtr].Next =TempPtr;
      }
}
  else
    printf("Full List ...\n");
}

void Delete(ListPointer *List, NodeType Node[], ListPointer *FreePtr, ListPointer PredPtr)
/* ÄÝ÷åôáé:   Ìéá óõíäåäåìÝíç ëßóôá êáé ôïí äåßêôç PredPtr ðïõ äåß÷íåé 
                óôïí ðñïçãïýìåíï êüìâï áðü áõôüí ðïõ èá äéáãñáöåß. 
  Ëåéôïõñãßá: ÄéáãñÜöåé áðü ôç óõíäåäåìÝíç ëßóôá, áí äåí åßíáé êåíÞ, 
                ôïí ðñïçãïýìåíï êüìâï áðü áõôüí óôïí ïðïßï äåß÷íåé ï PredPtr. 
  ÅðéóôñÝöåé: Ôçí ôñïðïðïéçìÝíç ëßóôá êáé ôï äåßêôç FreePtr. 
  ¸îïäïò:     ÌÞíõìá êåíÞò ëßóôáò, áí ç óõíäåäåìÝíç ëßóôá åßíáé êåíÞ 
*/
{
  ListPointer TempPtr ;

  if (!EmptyLList(*List)) 
    if (PredPtr == NilValue)
    {
        TempPtr =*List;
        *List =Node[TempPtr].Next;
        ReleaseNode(Node,TempPtr,&(*FreePtr));
    }
    else
      {
        TempPtr =Node[PredPtr].Next;
        Node[PredPtr].Next =Node[TempPtr].Next;
        ReleaseNode(Node,TempPtr,&(*FreePtr));
      }
  else
    printf("Empty List ...\n");
}

void TraverseLinked(ListPointer List, NodeType Node[])
/* ÄÝ÷åôáé:    Ìéá óõíäåäåìÝíç ëßóôá. 
   Ëåéôïõñãßá: ÊÜíåé äéÜó÷éóç ôçò óõíäåäåìÝíçò ëßóôáò, áí äåí åßíáé êåíÞ. 
   ¸îïäïò:     ÅîáñôÜôáé áðü ôçí åðåîåñãáóßá 
*/
{
  ListPointer CurrPtr;

  if (!EmptyLList(List)) 
  {
      CurrPtr =List;
      while (CurrPtr != NilValue) 
      {
          printf("(%d, %d, %f, %d) ",CurrPtr,Node[CurrPtr].Data.am,Node[CurrPtr].Data.ba8, Node[CurrPtr].Next);
          CurrPtr=Node[CurrPtr].Next;
       }
       printf("\n");
   }
  else printf("Empty List ...\n");
}

void FindMax(NodeType Node[],ListPointer List,StackType Stack)
{
    ListPointer CurrPtr;
    int i;

  if (!EmptyLList(List)) 
  {
        float max;
      CurrPtr =List;
      max=-1;
      while (CurrPtr != NilValue) 
      {
            if(Node[CurrPtr].Data.ba8>=max)
            max=Node[CurrPtr].Data.ba8; 

            CurrPtr=Node[CurrPtr].Next;                        
      }


        while (CurrPtr != NilValue) 
      {
            if(Node[CurrPtr].Data.ba8==max)
            {
                Push(&Stack,Node[CurrPtr].Data.am);

            }

            CurrPtr=Node[CurrPtr].Next;                        
      }
     printf("Oi mathites me ton megalytero bathmo ( %f  )  einai oi: \n",max);
      for (i=Stack.Top;i>=0;i--) {

        printf("%f, \n",Stack.Element[i]);
    }

  }
}


void CreateStack(StackType *Stack) 
/* Ëåéôïõñãßá: Äçìéïõñãåß ìéá êåíÞ óôïßâá.
   ÅðéóôñÝöåé: ÊåíÞ Óôïßâá.*
*/
{
    Stack -> Top = -1;
   // (*Stack).Top = -1;
}

boolean FullStack(StackType Stack) 
/* ÄÝ÷åôáé: Ìéá óôïßâá Stack. 
   Ëåéôïõñãßá: ÅëÝã÷åé áí ç óôïßâá Stack åßíáé ãåìÜôç. 
   ÅðéóôñÝöåé: True áí ç Stack åßíáé ãåìÜôç, False äéáöïñåôéêÜ 
*/
{
    return (Stack.Top == (StackLimit - 1));
}

void Push(StackType *Stack, StackElementType Item) 
/* ÄÝ÷åôáé: Ìéá óôïßâá Stack êáé Ýíá óôïé÷åßï Item. 
   Ëåéôïõñãßá: ÅéóÜãåé ôï óôïé÷åßï Item óôçí óôïßâá Stack áí ç Stack äåí åßíáé ãåìÜôç. 
   ÅðéóôñÝöåé: Ôçí ôñïðïðïéçìÝíç Stack. 
   ¸îïäïò: ÌÞíõìá ãåìÜôçò óôïßâáò, áí ç óôïßâá Stack åßíáé ãåìÜôç 
*/
{
    if (!FullStack(*Stack)) {
        Stack -> Top++;
        Stack -> Element[Stack -> Top] = Item;
    } else
        printf("Full Stack...");
}
This article has been dead for over six months. Start a new discussion instead.