I need help getting this code to work. Could someone tell me how to properly use strncmp and how to get this to work?
- Example: Enter first string: john
- Enter second string: johnson
- johnson does start with john
This is my code here:
#include <stdio.h>
#include<string.h>
int main()
{
char str1[20];
char str2[20];
int value;
printf("Enter the first string right here: ");
scanf("%s",str1);
printf("Enter the second string right here: ");
scanf("%s",str2);
value=strncmp(str1,str2);
if(value==0)
printf("Your strings are the same");
else
printf("Your strings are not same");
return 0;
}
This is what my error code is below
main.c:13:27: error: too few arguments to function call, expected 3, have 2
value=strncmp(str1,str2);
~~~~~~~ ^
1 error generated.
make: *** [<builtin>: main.o] Error 1
exit status 2 ```