I want to limit the scanf function so when I enter for example a char* array that has more then 30 characters, it will not get it and my outpu
char* array
You could use fgets and sscanf. With fgets you can read a little bit more than 30 characters and then check that you didn't get more than 30 characters.
fgets
sscanf
30
Or if you really want to use scanf use it with something more than 30 like %32s.
scanf
%32s