Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
void creatore(int c, int first, int var)
{
cell *n=new cell;
cell *n->data=first;
and this is the error
basic list.cpp:26:12: error: expected initializer before '->' token
cell *n->data=53;
can someone help me out!
You have declared your variable at
cell *n=new cell;
at the next line you are trying to re-declare it
cell *n->data=first;
Replace it with:
n->data=first;
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 months ago.
Improve this question
auto data = new char[480][640][3]();
char data = new char[480][640][3]();
First works.
Second doesnt.
Why? Isn't auto supposed to just replace itself with the type of the initializer?
Because the type isn't char. The type is char(*)[640][3] and the declaration would be written as
char (*data)[640][3] = new char[480][640][3]();
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I'm trying to solve a balanced parentheses problem, here in my code I'm trying to get 1 from a function is_empty() if top of my stack is empty but then here i am stuck with this ugly error.
int is_Empty()
{
int x=0;
if (top==NULL)
{
x=1;
}
return x;
}
here is how i recive it
if (s1.is_Empty==1)
{
cout<<"matched"<<endl;
}
my error log
bal.cpp:112:20: error: invalid use of member 'int stack::is_Empty()' (did you forget the '&' ?)
if (s1.is_Empty==1)
~~~^~~~~~~~
if (s1.is_Empty==1)
That is not how to call a function.
Here:
if (s1.is_Empty()==1)
You may wish to review your C++ book.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
Why is g++ giving an error like this?
blahblah.h:80:10: error: decomposition declaration not permitted in this context
float[NUM_OUTPUTS] output_buffer;
(Already solved, but creating this because there's no good google hits for this error text, and the error message is inscrutable.)
In C++ declarations, the array size goes after the variable name, not after the type:
float output_buffer[NUM_OUTPUTS];
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
So I'm creating this function as part of a larger program for my C++ course, and I am getting this error: no match for 'operator<<' followed by a bunch of gibberish whenever the compiler goes through this function
void print24hour(Time& start)
{
cout<<"The lecture starts at: ";
cout<<setfill('0')<<setw(2)<< start.getHours <<":"<<setfill('0')<<setw(2)<<start.getMinutes<<":"<<setfill('0')<<setw(2)<<start.getSeconds;
}
void print24hour(Time& end)
{
cout<<" and ends at: ";
cout<<setfill('0')<<setw(2)<<end.getHours<<":"<<setfill('0')<<setw(2)<<end.getMinutes<<":"<<setfill('0')<<setw(2)<<end.getSeconds<<endl;
}
Any solutions to my problem would be greatly appreciated
To get a function's return value you need to call it. Do this by appending parantheses to the member functions like end.getMinutes().
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
I have a function
int Customer::myFunction(char * cPhoneNumber)
{
//Something here
}
And i am trying to call this function with a parameter like:
char cPhoneNumber[MAX_STRING_LENGTH]; //MAX_STRING_LENGTH = 256
memset(cPhoneNumber, 0, sizeof(cPhoneNumber));
//Some value assigned
myFunction(cPhoneNumber);
But i get this error here:
cannot convert parameter 1 from 'char [256]' to 'char'
Why am i unable to pass this, please help.
The error is telling you that the declaration of Customer::myFunction is actually:
Customer::myFunction(char cPhoneNumber); // note char, not char*
You showed us the definition, but not the declaration. Either that, or you didn't post your definition correctly.