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 3354490
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:16:46+00:00 2026-05-18T02:16:46+00:00

this is my .h file: struct _MyString; typedef struct _MyString MyString; i would like

  • 0

this is my .h file:

struct _MyString;  
typedef struct _MyString MyString;

i would like to declare its members in the .c file.

i tried:

typedef struct MyString{
    char * _str;// pointer to the matrix
    unsigned long _strLength;
    }MyString;

but it doesn’t work.
how do i declare the struct’s memebers in the .c file?

thank you

  • 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-18T02:16:46+00:00Added an answer on May 18, 2026 at 2:16 am

    You need only 1 typedef. Keep the one you already have in the .h file and delete all others.

    Now, the struct name is struct _MyString. That is what you should define in the .c file, not struct MyString: notice the absence of the ‘_’.

    So

    .h file

    struct _MyString;  
    typedef struct _MyString MyString;
    

    .c file

    #include "file.h"
    struct _MyString {
        char * _str;// pointer to the matrix
        unsigned long _strLength;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've declared a struct in my header file like this: typedef struct { NSString
I have to write an object in to binary file.My struct looks like this.
I have a code like this- file:input.h struct Address{ int a; int b; };
I have this structure which I want to write to a file: typedef struct
Take this file as example,there are many non-extern structures like: struct list_head source_list; How
I am having this structure in a .c file: struct entry { int position;
I am using this file , to choose color, its a nice dialog, I
I'd like to build something like this: File 1: template<typename Vector> namespace myNamespace {
my project includes a simple C file with a header. Like this: #ifndef __IMAGE_ARRAY_3D
Hey. I have this in a header file: struct something { int a; int

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.