/**
what to do? make an array(len:5, size:10) and display it, using struct
-use a strcut: struct Arr{}
-write a function: void Display(struct Arr arr)
-int main()
{
struct Arr arr = {{1,2,3,4,5},5,10};
Display(arr);
}
**/
#include <stdio.h>
#include <unistd.h>
struct Arr
{
int A[10];
int len;
int size;
};
void Display(struct Arr arr)
{
int i = 0;
while(i < arr.len)
{
write(1, arr.A[i], 1);
i++;
}
}
int main()
{
struct Arr arr = {{1,2,3,4,5},5,10};
Display(arr);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: