#include <stdio.h>
#include <stdlib.h>
#define IsNull(expr) ((expr) == NULL)
#define CALLOC(var, size,type) ; \
if (IsNull((var) = ((type *)calloc((size),sizeof(type))))) { \
perror(0); return EXIT_FAILURE; \
};
inline void printArr(int *A, int f, int e) {
int i;
for (i = f; i < e; i++) {
printf("A[%d] = %d\n", i
, A
[i
]); }
}
int main(void) {
// your code goes here
int *a, *b, *p;
int i;
CALLOC(a,10,int);
CALLOC(b,10,int);
for (i = 0; i < 6; i++) {
a[i] = (i + 1) * (i + 1);
}
printArr(a, 0, 8);
if (IsNull(p)) {
return EXIT_FAILURE;
} else {
a = p;
}
printArr(a, 0, 8);
return EXIT_SUCCESS;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2RlZmluZSBJc051bGwoZXhwcikgKChleHByKSA9PSBOVUxMKQoKI2RlZmluZSBDQUxMT0ModmFyLCBzaXplLHR5cGUpIDsgXAoJaWYgKElzTnVsbCgodmFyKSA9ICgodHlwZSAqKWNhbGxvYygoc2l6ZSksc2l6ZW9mKHR5cGUpKSkpKSB7IFwKCQlwZXJyb3IoMCk7IHJldHVybiBFWElUX0ZBSUxVUkU7IFwKCX07CgppbmxpbmUgdm9pZCBwcmludEFycihpbnQgKkEsIGludCBmLCBpbnQgZSkgewoJaW50IGk7Cglmb3IgKGkgPSBmOyBpIDwgZTsgaSsrKSB7CgkJcHJpbnRmKCJBWyVkXSA9ICVkXG4iLCBpLCBBW2ldKTsKCX0KfQoKaW50IG1haW4odm9pZCkgewoJLy8geW91ciBjb2RlIGdvZXMgaGVyZQoJaW50ICphLCAqYiwgKnA7CglpbnQgaTsKCQoJQ0FMTE9DKGEsMTAsaW50KTsKCUNBTExPQyhiLDEwLGludCk7CgkKCWZvciAoaSA9IDA7IGkgPCA2OyBpKyspIHsKCQlhW2ldID0gKGkgKyAxKSAqIChpICsgMSk7Cgl9CgkKCXByaW50ZigiYToweCV4XG4iLCBhKTsKCXByaW50Zig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