Hi, it's been a while since I started this thread but I've been busy. I was working on my program and I got something but it gives me the wrong output. My professor said the output should be as follows.

f*f[0] = 0, f*f[i] = 0, f*f[2] = 16, f*f[3] = 64 and so on

my program compiles but it gives me outputs like this

nnindex: 0 convolution -1019395280

index: 0 convolution -1438002336

index: 1 convolution 0

index: 1 convolution -626327120

her is my source code if anyone would like to help me

Code:

#include<stdio.h>
void mult( int f[], int g[], int n){ /*function to multiply first array by 4*/
int i;
for (i =0; i < n; i++){
g[i] = 4 * f[i];
printf("n");
}
}
void convo(int f[], int g[], int h[], int n){ /*function to convolve the 2 arrays*/
int i, j;
for(i = 0; i < n; i++){
h[i] = 0;
for(j = 0; j < n; j++){
if (g[j]-f[i]>0){
h[i] += f[i]*(g[j]-f[i]); /*convolve the two arrays*/
printf("index: %d\t convolution %d\n", i, h[i]);
}
}
}
}
int main()
{
int n;
printf("enter the number of elements in the array: ");
scanf("%d", &n);
int f[n];
int g[n];
mult(f, g, n);
int h[n];
convo(f, g, h, n);
return 0;
}