[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

I get this compiler error message

Posted on 2003-12-02
8
Medium Priority
?
476 Views
Last Modified: 2011-10-03
what does this mean:

warning: passing arg 1 of `strlen' makes pointer from integer without a cast
0
Comment
Question by:buckeyes33
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Expert Comment

by:Gratch06
ID: 9863235
you're probably calling a function such as:

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.
0
 
LVL 9

Author Comment

by:buckeyes33
ID: 9863289
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;
      }
    }
0
 
LVL 9

Author Comment

by:buckeyes33
ID: 9863677
The problem is that I can not use a pointer to determine the string length.  
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 10

Expert Comment

by:Sys_Prog
ID: 9864305
Hi buckeyes33,

What's the declaration for pbin1

Amit
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 1000 total points
ID: 9864343
>warning: passing arg 1 of `strlen' makes pointer from integer without a cast
means that the first argument being passed to strlen is supposed to be a char * but you are passing an int instead and that too without explicitly casting it

for(i = 0; i <= strlen(*pbin1)- 1; i ++)
pbin1 could be a char * or an int * but *pbin1 means the value at that address which will be a char or an int ... You need to pass the starting "address" of the string
0
 
LVL 9

Author Comment

by:buckeyes33
ID: 9864345
Sys_prog
I figured it out and ask CS to delete question they just have not yet.
0
 
LVL 9

Author Comment

by:buckeyes33
ID: 9871413
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.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question