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 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

Just writing some CSS and I have a pretty cool Search form where you
I am writing some BASH script and I want it have some error handling
After writing some pretty terse C++ using the sub script operator, I have a
I have been writing some code which pulls entries from a MySQL database. These
I am writing some JSP 2.x tag files. I have searched for a few
I have been writing some code for a lib and experimented with a default
I have been writing some basic code for an application I am designing. I
When writing some rspec today, I came across some unexpected behavior with comparing Date
In writing some code today, I have happened upon a circumstance that has caused
I am writing some code and need the user to input a file for

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.