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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:33:06+00:00 2026-06-03T20:33:06+00:00

#ifndef ASSETS_H_INCLUDED #define ASSETS_H_INCLUDED #include <vector> #include string.h> const int ID_Max = 100; typedef

  • 0
#ifndef ASSETS_H_INCLUDED
#define ASSETS_H_INCLUDED
#include <vector>
#include string.h>

const int ID_Max = 100;
typedef char ID[ID_Max];

struct node;

struct people{
std::vector<ID> T_ID;
std::vector<node*> Nodes;
people(ID t, node* person){
    T_ID.push_back(t);
    Nodes.push_back(person);
}
people(){}
};

struct node {
ID T_ID;
node* Parent;
people* leftChildren;
node* rightChild;
node(ID t, node* p, node* l, node* r) :I_ID(t), Parent(p), rightChild(r) 
{leftChildren = new people(); }
};

#endif // ASSETS_H_INCLUDED

My problem is this it is interpreting ID as a char pointer when in the constructor so this is the constructor people::people(char*, node*) when I want people::people(char[ID_Max], node*) same for node. If you have advise it would be very appreciated.

  • 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-03T20:33:07+00:00Added an answer on June 3, 2026 at 8:33 pm

    If you write a function signature with an array type in it, it’s the same as using a pointer, e.g. this:

    void f(char p[]);
    

    is the same as this:

    void f(char *p);
    

    That looks like it’s the root of your problem here. You might be better off with e.g. a std::array<char,ID_Max> (in C++11), or a std::vector<char> (in C++98). You can then get a pointer to the start of the contiguous memory it contains using &cont[0]. As a minor nit, I seem to recall that the memory for vector wasn’t strictly guaranteed to be contiguous in C++98, but it always was contiguous in practice (you could rely on it). The wording was fixed in C++03.

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

Sidebar

Related Questions

#ifndef STRCUTS_H #define STRCUTS_H #include <string> struct menuEntry { string itemID; //'string' does not
Header: #ifndef BIT_H_INCLUDE_GUARD #define BIT_H_INCLUDE_GUARD typedef unsigned char byte; typedef struct{ size_t* size; byte*
#ifndef IMAGEDATA_H #define IMAGEDATA_H #include <iostream> #include <vector> class ImageData { public: std::string foo;
Suppose I got this in Message.h: #ifndef _MESSAGE_H_ #define _MESSAGE_H_ #include <stdio.h> #include <string.h>
Header file is graph.h #ifndef _GRAPH_H_ #define _GRAPH_H_ #include <map> #include <vector> using namespace
#ifndef VECTOR #define VECTOR template<typename T> struct vector { private: T *buffer; unsigned long
Test.h #ifndef TEST_H #define TEST_H #include <memory> template <class Type> bool operator==(const std::weak_ptr<Type>& wp1,
###MyClass.h### #ifndef _MyClass #define _MyClass #include <string> using namespace std; class MyClass { public:
#ifndef QWERT_H #define QWERT_H const int x [] = {1, 2,}; const int z
Defined as: Class.h #ifndef CLASS_H_ #define CLASS_H_ #include Class2.h #include <iostream> struct Struct1{ };

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.