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

  • Home
  • SEARCH
  • 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 1957962
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T07:57:13+00:00 2026-05-17T07:57:13+00:00

I writing some ADT on C: I have two file date.c and date.h inside

  • 0

I writing some ADT on C:
I have two file date.c and date.h
inside date.c I have:

typedef struct Date_t {
 int date;
 char* month;
 int year;

} Date;

inside date.h I have:

typedef Date pDate;

compiler gives me errors:

..\checking.h:15: error: syntax error before "pDate"

can somebody please explain what is wrong with my typedef, thanks in advance

EDIT:

with files all is ok, problem is, when I change my struct to:

struct Date_t {
     int date;
     char* month;
     int year;
    
    };

and pointer to:

typedef struct Date_t* pDate;

program works perfectly, so I want to understand the difference

  • 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-05-17T07:57:14+00:00Added an answer on May 17, 2026 at 7:57 am

    You are probably declaring pDate as a typedef of Date before you even declared Date (since you are make pDate in the header).

    You could do:

    typedef struct Date_t {
     int date;
     char* month;
     int year;
    
    } Date;
    
    typedef Date pDate;
    

    All in you .c file.

    As for your edit:

    You are declaring the struct in the typedef:

    typedef struct Date_t* pDate;
    

    It is working because you are declaring struct before you place pDate.

    typedef /*see this struct here*/ struct /*huh?*/ Date_t* pDate;
    

    The other has no struct in it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing some documentation in Markdown, and creating a separate file for each section
Say I'm writing some ruby code and I want to use the standard Date
Writing some test scripts in IronPython, I want to verify whether a window is
I was writing some ASP.NET control when I came to the scenario where I
I'm writing some data acquisition software and need a gui plotting library that is
I am writing some code to determine whether a network domain is registered. For
So I was writing some code today that basically looks like this: string returnString
I'm writing some semi-portable code and want to be able to detect when I'm
I'm writing some DB routines and I'm using prepared statements. My environment is PDO
I was writing some Unit tests last week for a piece of code that

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.