I want the user to enter a 4 digit number and the program must tell what that 4 digit number was i.e generate that 4 digit number by Brute force attack.But at the line mentioned below the compiler says invalid indirection.I would also like to have some comments about they way I am implementing it,is it a good practise?
#include<stdio.h>
void BruteForceAttack(int *arr);
int main()
{
int *arr,i;
printf("Enter 4 digits ,press enter after entring each digit:\n");
for(i=0;i<4;i++)
scanf("%d",arr+i);
BruteForceAttack(arr);
getchar();
return 0;
}
void BruteForceAttack(int *arr)
{
int i,j,k,l;
for(i=0;;i++)
{
for(j=0;;j++)
{
for(k=0;;k++)
{
for(l=0;;l++)
{
if((*(arr+0)==i)&&(*(arr+1==j))&&(*(arr+2==k))&&(*(arr+3)==l)) /*Here the compiler says invalid indirection*/
{
printf("The number is %d%d%d%d",i,j,k,l);
return;
}
}
}
}
}
}