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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:21:04+00:00 2026-06-07T23:21:04+00:00

I am attempting to change a value in a vector which is a variable

  • 0

I am attempting to change a value in a vector which is a variable in a class using a function of a class. When I compile, i get the following errors pointing to the “check[c] = cval;” line:

  • error C3867: ‘acc::check’: function call missing argument list; use ‘&acc::check’ to create a pointer to member

  • error C2109: subscript requires array or pointer type

Note: I have already initialized C to be 0 elsewhere in the program. It might be throwing an error because I am giving the address a variable instead of an integer, but when I substitute the variable with an integer, I still get the same errors.

    #include <iostream>
    #include <fstream>
    #include <string>
    #include <vector>
    #include <cstring>

    using namespace std;

    class acc
    {
    public:
        void add_Cval(double cval);

    private:
        vector<double> check(); //vector of all checks
        int c;                  //loop marker for cvals
    };

    void acc::add_Cval(double cval)
    {
        check[c] = cval;
        c++;
    }
  • 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-07T23:21:05+00:00Added an answer on June 7, 2026 at 11:21 pm

    check is a method, not a data member, so you need to invoke it – check().

    void acc::add_Cval(double cval)
    {
        check()[c] = cval;
        c++;
    }
    

    or make it a data member:

    class acc
    {
    public:
        void add_Cval(double cval);
    
    private:
        vector<double> check; //vector of all checks
        int c;                  //loop marker for cvals
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to change the value of a global variable inside a javascript function,
I'm attempting to compile code in a text file to change a value in
I'm attempting to change the style of a button using the :checked and :unchecked
Using Bootstrap's typeahead javascript plugin, I'm attempting to change the data-source attribute via jQuery's
Attempting something like public string MyText { get {return lbl.Text;} set {lbl.Text = value;}}
I'm looking to write a jQuery function that will change the value of other
I am attempting to remove a value from an array using splice. starting at
I'm trying to change the integer values in a vector using transform and an
When attempting to access the '.box' class of the $container, using (this) inside of
I am attempting to change the value of a text input based on the

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.