This is my program to convert a binary to a decimal value.
#include <stdio.h>
#include <string.h>
#include <math.h>
void con(){
unsigned long long int dec = 0, bin;
int i;
printf ("\n Binary : ");
scanf("%lld",&bin);
for (i = strlen(bin) - 1; i <= 0; --i){ // Warning in here
dec = dec + (bin[i] * pow (2, i)); // Error in here
}
printf(" Decimal : %lld",dec);
con();
}
int main(){
con();
return 0;
}
When i compile the code, this error shows up ," Subscripted value is neither array nor pointer nor vector". And this warning also ," Passing argument 1 of strlen makes pointer from integer without a cast".
Why am i getting these and how can i fix them?
binisunsigned long long int, not a pointer or an array... - StoryTeller - Unslander Monica