TAD – Creation of a set of integers in C

Galera, my teacher asked that from a given structure:

typedef struct set {

int num_elem;

int * v;

Set_t};

A function = set_t * new_set (int * v1) was created to create a new set from an integer vector.

In the event of an error in the operating system, it must be taken into account that, in the event of an error, Follow the code:

typedef struct set {

int num_elem;

int * v;

Set_t};

set_t * new_set (int * v1) {}

set_t * new;

(int i = 0; i <= (sizeof (v1) / sizeof (int)), i ++) {}

New-> v[i]= v1[i];

}

new-> num_elem = (sizeof (v1) / sizeof (int)) + 1;

new return;
}

int main () {} ()

int * vector, num;

set_t * set;

printf ("Number of elements:");

scanf ("% d", & num);

printf (" n");

vector = (int *) malloc (sizeof a * (int));

(int i = 0; i)

printf ("Enter the number:");

scanf ("% d", and Vector[i]);

printf (" n");

}

set = new_set (vector);

}