The exercise I'm doing asked to create an array of 50 characters, to put it in a structure and then use a subroutine to print the array on the screen and to say how many characters it has ( there's more but the problem that I have is here )
this is what I did
#include <stdio.h>
#include <string.h>
int Anzahl (char []);
int main ()
{
int x;
char kette [50];
printf ("Type down something\n");
fgets (kette,50,stdin);
struct hullo {
char kette [50];
};
x=Anzahl (&kette[50]);
printf ("the number of letters is : %d", x);
}
int Anzahl (char kette[50])
{
int x1;
puts (&kette[50]);
x1 = sizeof (kette[50]);
return x1;
}
`
but each time I type something, the number of characters is always 1 in the end. would be nice if someone could explain to me what I did wrong.