I am a student and I will have a presentation at school about arrays. I have this code that should assign a whole array into another array.
#define MAX 10
#include <stdio.h>
typedef struct {
int data[MAX];
} INT_ARR;
int main()
{
int i;
INT_ARR arr1 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
INT_ARR arr2 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
arr1 = arr2;
return 0;
}
- How can I use this technique in real projects?
- What I can do with this?
- What are the pros and cons?
malloc()/calloc(), and then just assign pointer of one array to another. Depends on your particular task.poleX = poleY;simply does not compile). So I wonder what the "practical consideration when doing array assigments in this specifc way" should be, if not the "work-arounds" mentioned on the answers I linked.