The principle of working with strings in C is that they represent an array of characters ( char ), the last one whose bounding element is the zero character \0 . And a string variable is essentially a pointer to the first element of this array. Another consideration is that the name of an array can be viewed as a (constant) pointer to its first character.
Proceeding from this, we consider what the function scanf("%s",???) needs. And she needs to specify a place in memory where to read data. Those. in fact, the address of the place where the first character will be located.
Recall what was said earlier. If we have an array, then its name is this address, so you can write
char array[50]; ... scanf("%s",array);
Memory can be allocated dynamically, for example:
char * str = malloc(50); ... scanf("%s",str);
After the first instruction, str points to allocated memory (that is, it contains the address of the first character in this memory).
The string comparison function strcmp , the pointers to the first characters of the strings, wants exactly the same arguments. So, as in scanf , in strcmp you need to pass pointers to the place in memory where strings are stored (and not to the place in memory where the addresses of the first elements are stored), i.e.
strcmp(sr, array);
input_pass? - post_zeew%s. See what you have. Draw conclusions. Repeat the same for thestrcmpfunction. Read the warnings that the compiler gave you when compiling this. - VladDinput_passpointer indicates where it is unknown. Why don't you (for a start) just read the password in a character array? Writechar input_pass[100];and try. - avpchar **input_pass;Thanks a lot! I will definitely take your advice into account. - Vladimir