On the last return line, I get the error:
Thread 1: Signal SIGABRT.
I have written the C program on xcode.
This is a program to multiply an array by 3 and return new values.
Please tell me what the error is and any suggestions to make this program work.
Learning C from 2 weeks.
#include <stdio.h>
int modify(int anth[10])
{
int i;
for(i=0;i<10;i++)
{
anth*=3;
}
return anth[10];
}
int main(int argc, const char * argv[])
{
int i, *anth;
int arr[10]={1,2,3,4,5,6,7,8,9,10};
anth=arr;
modify(&arr[10]);
for(i=0;i<=9;i++)
{
printf("%d.", arr);
}
return 0;
}
Thread 1: Signal SIGABRT.
I have written the C program on xcode.
This is a program to multiply an array by 3 and return new values.
Please tell me what the error is and any suggestions to make this program work.
Learning C from 2 weeks.
#include <stdio.h>
int modify(int anth[10])
{
int i;
for(i=0;i<10;i++)
{
anth*=3;
}
return anth[10];
}
int main(int argc, const char * argv[])
{
int i, *anth;
int arr[10]={1,2,3,4,5,6,7,8,9,10};
anth=arr;
modify(&arr[10]);
for(i=0;i<=9;i++)
{
printf("%d.", arr);
}
return 0;
}