Solved

what is this error?

Posted on 2003-12-02
7
1,290 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
  • 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Binary Bomb: Phase 4 func4 3 330
C++ vs C compilers 13 159
xamarin c# deserialize Json containing nested object 2 91
Why is compiler in oracle server ? 9 64
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
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…
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 switch statements in the C programming language.

776 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