I have created a function in C in order to count the amount of chars in the word that was input. I have debuged the code and all the variables are working properly. However when debuging the code and trying to use printf to present the result, an alert window pops up with the followig message: "Program Received Signal SIGSEV, Segmentation Fault". Please, could you help me address the problem, so the numer of chars are properly showed on the screen ? Down below is the code. Thanks.
#include<stdio.h>
#include<string.h>
int len(char v[]);
int main(){
int x=0;
char s[512];
printf("Please input the word: ");
gets(s);
printf(len(s));
return 0;
}
int len(char v[]){
char h[512];
int i=0;
while(h[i]=v[i]){
i++;
}
return i;
}