First Upload
This commit is contained in:
41
18 - Lists/ex4.c
Normal file
41
18 - Lists/ex4.c
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "Lib.h"
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
// LongestString
|
||||
// -------------
|
||||
//
|
||||
// General : The function check who the longest string in list
|
||||
//
|
||||
// Parameters : **manager - pointer linear Linked List(IN)
|
||||
//
|
||||
// Return Value : The index of longest string
|
||||
//
|
||||
//-------------------------------------------------------------------
|
||||
// Programer : Cohen Idan
|
||||
// Student No. : 211675038
|
||||
// Date : 12.12.2019
|
||||
//-------------------------------------------------------------------
|
||||
LLL * LongestString(LLL ** manager)
|
||||
{
|
||||
LLL * runner = *manager;
|
||||
LLL * result = runner;
|
||||
unsigned int max = ZERO;
|
||||
unsigned int str_len = ZERO;
|
||||
while (runner != NULL)
|
||||
{
|
||||
str_len = StringLenght((*runner).value.pointer);
|
||||
if (str_len > max)
|
||||
{
|
||||
max = str_len;
|
||||
result = runner;
|
||||
}
|
||||
runner = (*runner).next;
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user