Question
I don't know what's wrong with my C Programming Language, this is my code and error screenshot #include void rearrange(int *a, int n, int insert,
I don't know what's wrong with my C Programming Language, this is my code and error screenshot
#include
void rearrange(int *a, int n, int insert, int *b)
{
int *d = a;
for(int i = 0; i
{
int c = *a;
if(c
{
*b = c;
*b++;
}
*a++;
}
*b = insert;
*b++;
for(int i = 0; i
{
int c = *d;
if(c > insert)
{
*b = c;
*b++;
}
*d++;
}
}
int main()
{
int n, insert;
printf("Enter the length of the array: ");
scanf("%d",&n);
int a[n], b[n];
printf("Enter the elements of the array: ");
for(int i = 0; i
{
scanf("%d", &a[i]);
printf("Enter the number for insertion: ");
scanf("%d",&insert);
rearrange(a,n,insert,b);
printf("Output: ");
}
for(int i=0; i
{
printf("%d ", b[i]);
printf(" ");
}
return 0;
}
arrays.c: In function rearrange" : arrays.c:9:5: error: 'for' loop initial declarations are only allowed in 199 mode for(int i = 0; iStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started