#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

struct Arr
{
    int *A;
    int size;
    int len;
};

void Display(struct Arr arr)
{
    int i;
    printf("\nelements: \n");
    i = 0;
    while(i < arr.len)
    { 
        printf("%d ", arr.A[i]);
        i++;
    } 
}

int main() {
    struct Arr arr;
    int n, i;

    write(1, "1.Enter size of arr\n", 19);
    scanf("%d", &arr.size);
    arr.A = (int*)malloc(arr.size * sizeof(int));
    arr.len = 0;

    write(1, "2.Enter nb of nbs\n", 19);
    scanf("%d", &n);

    write(1, "3.Enter all elems\n", 19);
    i = 0;
    while(i < n)
     { 
       scanf("%d", &arr.A[i]);
        i++;
    } 
    arr.len=n;

    Display(arr);
    free(arr.A);

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: