Question: #include struct fancyArray { int len; double ave; int arr[]; }; void add42(struct fancyArray *fancy) { fancy->arr[fancy->len] = 42; fancy->len++; } int main() { struct
#include
struct fancyArray { int len; double ave; int arr[]; };
void add42(struct fancyArray *fancy) { fancy->arr[fancy->len] = 42; fancy->len++; }
int main() { struct fancyArray fancy = { 10, 29.50, { 1, 2, 5, 10, 17, 26, 37, 58, 65, 82 } };
printf("len: %d ", fancy.len); printf("ave: %f ", fancy.ave); printf("arr: "); for (int i = 0; i < fancy.len; i++) { printf("%d ", fancy.arr[i]); } printf(" ");
add42(&fancy);
printf("Print with function: "); printf("len: %d ", fancy.len); printf("ave: %f ", fancy.ave); printf("arr: "); for (int i = 0; i < fancy.len; i++) { printf("%d ", fancy.arr[i]); } printf(" ");
return 0; } coding in C and can't get program to compile and run correctly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
