/**
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},5,10};
Display(arr);
}
**/
#include <stdio.h>
#include <unistd.h>
struct Arr
{
int A[20];
int size;
int len;
};
void Display(struct Arr arr)
{
int i = 0;
char j;
while(i < arr.len)
{
char j = arr.A[i] + '0';
write(1, &j, 1); //arr.A[i] ! (X arr[i])
i++;
}
}
int main() {
struct Arr arr = {{1,2,3}, 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: