buckeyes33
asked on
I get this compiler error message
what does this mean:
warning: passing arg 1 of `strlen' makes pointer from integer without a cast
warning: passing arg 1 of `strlen' makes pointer from integer without a cast
ASKER
the lines the the compiler are telling me tis the problem are for for loops
here is an example
for(i = 0; i <= strlen(*pbin1)- 1; i ++)
{
if(*pbin1[i] != BINNUM1 && *pbin1[i] != BINNUM0)
{
j = 1;
}
}
here is an example
for(i = 0; i <= strlen(*pbin1)- 1; i ++)
{
if(*pbin1[i] != BINNUM1 && *pbin1[i] != BINNUM0)
{
j = 1;
}
}
ASKER
The problem is that I can not use a pointer to determine the string length.
Hi buckeyes33,
What's the declaration for pbin1
Amit
What's the declaration for pbin1
Amit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sys_prog
I figured it out and ask CS to delete question they just have not yet.
I figured it out and ask CS to delete question they just have not yet.
ASKER
I just decided that since Sunnycoder got the correct answer that I will accept his question. I did not state how I figured it out where as he did.
function1(int* intVar);
with the function call:
function1(strlen(....));
In which case, the strlen funtion returns an integer, but your funtion wants a pointer to a value (integer or otherwise). C will not dereference and convert this to a pointer, but will take the value as is and use it as a pointer, a flaw which can prove fatal to your program.