Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8775251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:45:31+00:00 2026-06-13T18:45:31+00:00

I have trouble understanding c header files and source files. I have: something.c #include

  • 0

I have trouble understanding c header files and source files. I have:

something.c

#include <stdio.h>
#include "something.h"

typedef struct {
    int row, col;
} point;

point
whereispoint(point **matrix, int rows, int cols)
{
   ..... Does something ....
   printf("something...");
}

something.h

typedef struct point * p;

p whereispoint(p **matrix, int rows, int cols);

main.c

#include <stdio.h>
#include "something.h"

int
main(void)
{
   int row, col;
   p **matrix=malloc(bla, bla);
   .....Something.....
   p=whereispoint(matrix, row, col);
   return 0;
}

Now when I don’t actually know how to compile this… I tried gcc -c main.c something.c
but that doesn’t work, I tried to compile separately gcc -c main.c and gcc -c something.c
then main.c works but something.c does not.

I am actually trying to make a library out of something.c but as I am not able even to compile it to object code I don’t know what to do. I guess there is something wrong with the struct type and the typedef of it in something.h but I can’t figure out what…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:45:32+00:00Added an answer on June 13, 2026 at 6:45 pm

    In the header, the function whereispoint() is declare as returning a struct point* (the typedef p) but the definition returns a struct point, not a pointer.

    Personally, I find typedef pointers confusing and think it is clearer in the code if * is used to denote a pointer:

    /* header */
    typedef struct point point_t;
    
    point_t* whereispoint(point_t** matrix, int rows, int cols);
    
    /* .c */
    struct point {
        int row, col;
    };
    
    point_t* whereispoint(point_t** matrix, int rows, int cols)
    {
       ..... Does something ....
       printf("something...");
       return ??;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have trouble understanding what's wrong with my code. Point A = new Point((int)CENTER_X,
The idea of MVC itself seems clear to me but I have trouble understanding
I'm having trouble understanding using D3 events and dispatch functions. I have a chart
I have a 64-tap FIR filter whose output format I am having trouble understanding.
I have trouble understanding the following thing: in my localized application I have an
While studying C# in ASP.net I have trouble understanding several classes. In which scenario
Im new to obj-c and have trouble understanding the function autorelease. could someone explain
I have some trouble understanding the need for std::result_of in C++0x. If I understood
I have trouble understanding this chunk of code: let sieve (p:xs) = p :
I have trouble understanding the compilers. The following code does work in UNIX under

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.