First Upload

This commit is contained in:
2022-02-25 15:33:16 +02:00
commit 0c74d10f0d
295 changed files with 74784 additions and 0 deletions

65
18 - Lists/ex3.c Normal file
View File

@@ -0,0 +1,65 @@
#include "Lib.h"
//-----------------------------------------------------------------
// SumOfNextLLL
// ------------
//
// General : The function summarizes it from the current
// position to the end of the list and puts it in
// the position of the array so that the first organ
// in the array contains the largest amount
//
// Parameters : **manager - pointer linear Linked List(IN)
// *ptr_vec - vector of int(IN)
//
// Return Value : None
//
//-------------------------------------------------------------------
// Programer : Cohen Idan
// Student No. : 211675038
// Date : 12.12.2019
//-------------------------------------------------------------------
void SumOfNextLLL(LLL ** manager, int * ptr_vec)
{
LLL * temp = *manager;
unsigned short length_list = ZERO;
unsigned short length_vec = ZERO;
while (temp != NULL)
{
while (length_vec--)
{
*(ptr_vec + length_vec) += (*temp).value.int_;;
}
length_vec = ++length_list;
temp = (*temp).next;
}
}
void main(void)
{
LLL * manager = NULL;
PushList(&manager);
PushList(&manager);
PushList(&manager);
PushList(&manager);
PopList(&manager);
printf("h\n");
LLL * pos = manager;
printf("h\n");
(*pos).value.int_ = 10;
printf("h\n");
(*(*pos).next).value.int_ = 20;
printf("h\n");
(*(*(*pos).next).next).value.int_ = 30;
printf("h\n");
//(*(*(*(*pos).next).next).next).value.int_ = 40;
pos = manager;
while (pos != NULL)
{
printf("%d\n" ,(*pos).value.int_);
pos = (*pos).next;
}
}