[Last Call] Learn how to a build a cloud-first strategyRegister Now


Function differs in levels of indirection from... Error.

Posted on 2004-11-16
Medium Priority
Last Modified: 2010-04-15
I asked a question yesterday about one of my search function not working correctly. I got the answer and it seems to work, however when I try to compile, I get an error "error C2040: 'Search' : 'PtrModel (PtrModel,char *)' differs in levels of indirection from 'int ()'" I have no idea on how to fix it, so if someone already saw this message, I would like some help please !

PtrModel Search(PtrModel list, char* val)
     PtrModel CurPtr = list;
          if(CurPtr->modelName == val)
               return CurPtr;
          CurPtr = CurPtr->next;
     return 0;

Thanks, Frank
Question by:The_Kingpin08
LVL 86

Accepted Solution

jkr earned 2000 total points
ID: 12596618
Could you post the code before that snippet? It seems that for some reason the compiler thinks you are declaring a variable here...

Author Comment

ID: 12597938
Ok I found the problem. You were half right, the compiler thought I was declaring function so I predefined them at the beggining of my code and now it workd fine.



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

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 is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand recursion 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.

830 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