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

44
12/ex1.c Normal file
View File

@@ -0,0 +1,44 @@
#include <stdio.h>
#include <malloc.h>
#include "PointersLibs.h"
int * EvenSubArray(int vec[], int len, int *ptr_even)
{
int * ptr_even_vec = (int)malloc(sizeof(int));
unsigned int counter;
for (counter = ZERO; counter < len; counter++)
{
if (!(vec[counter] % TWO))
{
(*ptr_even)++;
ptr_even_vec = realloc(ptr_even_vec, (*ptr_even));
*(ptr_even_vec++) = vec[counter];
}
}
return (ptr_even_vec);
}
//---------------------------------------------------------------------------------------
// exe 1
// -----
//
// General : The program gets an array and separates the even
// numbers from it to the pointer.
//
// Input : an array of numbers, its length.
//
// Process : the program goes over the array and puts the even nums
// in the pointer array.
//
// Output : if there are even nums, and if there are, print them.
//
//---------------------------------------------------------------------------------------
// Proggramer : Cohen Idan
// Student No : 211675038
// Date : 21.11.19
//---------------------------------------------------------------------------------------
void main(void)
{
}