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

Posted on 2004-11-16
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

    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

    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.



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    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…
    This tutorial is posted by Aaron Wojnowski, administrator at  To view more iPhone tutorials, visit This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
    Video by: Grant
    The goal of this video is to provide viewers with basic examples to understand and use nested-loops 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.

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now