this code is a part of larger assignment
all it's supposed to do is receive a number from player1...
check is the number of digits matches up with the number asked in the beginning,
then ask player2 for a number and check if it has the same number of digits.
there are no errors in this code, but there are 7 warnings.
all in rows that use gets() and strlen()
the program runs, but doesn't do what it's supposed to.
i'm obviously not using these functions correctly.
what am i doin wrong ?
Code:
#include <stdio.h>
#include <string.h>
int dig_count, count, len;
int p1in[256], p2in[256];
main()
{
printf("\nHow many digits do you want(3 - 6) ? ->");
scanf("%d",&dig_count);
while(dig_count>6 || dig_count<3)
{
printf("Bad input, try again.\n");
scanf("%d",&dig_count);
}
printf("Player #1: Enter your number ( %d digits): ->",dig_count);
gets(p1in); //-!
len=strlen(p1in); //-!
while(len!=dig_count)
{
printf("Bad input, try again.\n");
gets(p1in); //-!
len=strlen(p1in); //-!
}
printf("Player #2: Enter your guess ( %d digits, 0- to exit): ->",dig_count);
gets(p2in); //-!
len=strlen(p2in); //-!
while(len!=dig_count && p2in!=0)
{
printf("Bad input, try again.\n");
gets(p2in); //-!
}
}
the warnings all say "passing arg 1 of (whichever function is in the row) from incompatible pointer type"
are the arrays being identified ans pointers ?
what's goin on here ?