Write a program to compute the sum of all elements of an int array using only pointers.
Correct the following program which issues a warning on compilation but fails at runtime.
Does the create_array function return an array?
#include
short * create_array(void);
int main(void)
{
short i;
short *brr;
brr = create_array();
for (i = 0; i <>
printf(“%hd “, brr[i]);
return 0;
}
short * create_array(void)
short arr[ ] = {1, 3, 5, 7, 99, 88};
return arr;
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here