gets
returns char*
. In this context – It is wrong to write char *[]
in the function definition where you are supposedly passing a char
array where input characters are being stored using gets
. Also char *gets(char *str)
– you need to pass a buffer to the gets
where the inputted letters will be stored. You didn’t pass one.
sizeof
doesn’t work here. It returns the size of a pointer (char*
). You will have to use strlen()
to get the length of the string inputted by gets
.
More importantly – don’t use gets
– it’s time to use something much safer than gets
, namely fgets
etc. Buffer overflow is not something you want to deal with.
Suppose you are passing an array of char*
to the function reverse
. Then the parameter would be char*[]
which means nothing other than char**
here. Here you will simply pass the char
array which you will be using as buffer to gets
.
0
solved C error: Exited with non-zero status