Solved

what is this error?

Posted on 2003-12-02
7
1,294 Views
Last Modified: 2008-03-10
when i compile I get this

invalid type argument of `unary *'
 
What is it?
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
  • 4
  • 3
7 Comments
 
LVL 9

Expert Comment

by:tinchos
ID: 9863770
Hi buckeyes33,

Place your code and tell us in which line you get that error so we can help you

Tincho
0
 
LVL 9

Author Comment

by:buckeyes33
ID: 9863807
here

   for(i = 0; i <= strlen(bin1)- 1; i ++)
    {
      if(*pbin1[i] != BINNUM1 && *pbin1[i] != BINNUM0)   //this is the line
      {
        j = 1;
      }
    }
0
 
LVL 9

Accepted Solution

by:
tinchos earned 125 total points
ID: 9863835
I'm not sure what's the type of pbin1

but I would say that it must be a char[] or an int[]

in this case

you derreference pbin1 using [] operator

so making pbin1[i] returns a char or an int

and you cannot run operator * to an int or a char


Example

char cV[5];
int  iV[4];

// fill cV and iV

*cV returns a char
cv[1] returns a char
*cv[1] is not valid, as you're applying operator * to a char and you need to apply it to a pointer

*iV returns an int
iv[1] returns an int
*iv[1] is not valid, as you're applying operator * to an int and you need to apply it to a pointer

However, this is just assuming that pbin1 is a char[] or an int[]

If that is the case, then this answer suits you, otherwise, post the definition of pbin1 and I'll be able to help you a little more.

Tincho
0
Technology Partners: 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!

 
LVL 9

Author Comment

by:buckeyes33
ID: 9863948
it is a char[]   it is a pointer for a variable of for a binary string.

i see that you know your C stuff.  I will increase this question a lot if you can help me out some more(or maybe a lot).  I am having some serous problems with passing information to functions.  My programs has lots of errors due to this and other logical mistakes.   However I am running out of time to get help elsewhere.  If you want to help then i could email you my code and what I am trying to do with it.
0
 
LVL 9

Author Comment

by:buckeyes33
ID: 9863965
just to give you a list of my errors.

project4.c: In function `option1':
project4.c:93: parse error before `;'
project4.c:95: parse error before `;'
project4.c:121: warning: passing arg 1 of `checkforBinary' makes integer from pointer without a cast
project4.c:121: warning: passing arg 2 of `checkforBinary' makes integer from pointer without a cast
project4.c: At top level:
project4.c:123: parse error before `while'
project4.c:126: parse error before `*'
project4.c:126: conflicting types for `addBinary'
project4.c:27: previous declaration of `addBinary'
project4.c:126: warning: data definition has no type or storage class
project4.c:136: parse error before string constant
project4.c:136: warning: data definition has no type or storage class
project4.c:171: conflicting types for `checkforBinary'
project4.c:30: previous declaration of `checkforBinary'
project4.c:219: conflicting types for `addBinary'
project4.c:126: previous declaration of `addBinary'
project4.c: In function `addBinary':
project4.c:231: warning: passing arg 1 of `strlen' makes pointer from integer without a cast
project4.c:234: warning: passing arg 1 of `strlen' makes pointer from integer without a cast
project4.c:237: subscripted value is neither array nor pointer
project4.c:237: subscripted value is neither array nor pointer
project4.c: In function `userOption2':
project4.c:299: warning: passing arg 3 of `convert' makes pointer from integer without a cast
project4.c:303: too few arguments to function `converttobin'
project4.c:305: warning: `return' with a value, in function returning void
project4.c: At top level:
project4.c:331: warning: type mismatch with previous implicit declaration
project4.c:297: warning: previous implicit declaration of `getBinary2'
project4.c:331: warning: `getBinary2' was previously implicitly declared to return `int'
project4.c:412: conflicting types for `convert'
project4.c:28: previous declaration of `convert'
project4.c:457: conflicting types for `converttobin'
project4.c:29: previous declaration of `converttobin'
project4.c: In function `converttobin':
project4.c:459: `bin' undeclared (first use in this function)
project4.c:459: (Each undeclared identifier is reported only once
project4.c:459: for each function it appears in.)


i can't post the code here due to copy cats.
0
 
LVL 9

Expert Comment

by:tinchos
ID: 9863970
buckeyes33,

Sorry but all help must go through some thread here, so that all other experts can also help

However, please either close this question if your question was answered and post another one with your other problems

You'll see that you'll get help from all of us

Glad it helped.

Tincho
0
 
LVL 9

Author Comment

by:buckeyes33
ID: 9864031
I just can't put the code in the threads.  This is b/c they run our programs through a program to test for similarity and I can't afford to have someone take my just.
0

Featured Post

Independent Software Vendors: 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

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
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 pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

726 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