Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
5 answers
2k views

Why do we need the address-of operator (ampersand, &) when passing a variable to scanf, but not when assigning to it?

When using the scanf function, we cannot simply specify the variable name. Rather, we have to prefix the variable name with an ampersand, e.g. int a; printf("enter your value"); scanf("...
kishoreraj's user avatar
2 votes
1 answer
1k views

C++ pass vector (lvalue to rvalue)

Lets say you have 2 vectors passed to a function as lvalue references. Later you realize, you can use recursion and pass slices of these vectors using their iterators. Would it be an appropriate ...
user2376997's user avatar
-1 votes
2 answers
823 views

error: invalid initialization of non-const reference of type 'std::function<void()>&' from an rvalue of type 'main()::<lambda()>'|

EDIT: Sorry, I asked this question without a thro understanding of references... I seem to be getting this error when I run this code... error: invalid initialization of non-const reference of type ...
Samuel's user avatar
  • 314
2 votes
1 answer
278 views

Lvalue to rvalue conversion with integer pointer

If I read implicit conversions correctly: Lvalue to rvalue conversion A glvalue of any non-function, non-array type T can be implicitly converted to a prvalue of the same type. [..] Unless ...
Dean's user avatar
  • 6,920
3 votes
1 answer
274 views

Does a Comparison Between an Lvalue and a Literal Invoke an Lvalue-to-Rvalue Conversion?

I asked this question: static_assert of const Variable And apparently it comes down to the question does a floating point lvalue get converted to an rvalue for the purposes of comparison? So in this ...
Jonathan Mee's user avatar
  • 38.9k
0 votes
1 answer
878 views

Delete a node from binary search tree in C

I am trying to delete a node from a binary search tree. But when I want to test the function, I'll get an error message in 'case 3: two children'. clist->name = temp->name; This line causes ...
stefOCDP's user avatar
  • 863
3 votes
5 answers
2k views

Will an lvalue to rvalue conversion happen?

C++ Standard (4/5) the lvalue-to-rvalue conversion is not done on the operand of the unary & operator. For example: int x; int *p = &x; In the above case, are p are &x both lvalues? ...
user1086635's user avatar
  • 1,544
7 votes
2 answers
1k views

Regarding lvalue-to-rvalue conversion, when is it required?

I've been reading quite many on the Internet and it seems that many people mentioned the following rules (but i couldn't find it in the standard), The addition operator + (and all other binary ...
user534498's user avatar
  • 3,964
1 vote
3 answers
906 views

regarding lvalue-to-rvalue conversion

"lvalue-to-rvalue conversion is not done on the operand of the unary & operator." May I know what it meant for >Can any one explain ..It Please Ex: int a[]={1,5}; int* x=&a;
user avatar
16 votes
4 answers
7k views

Array and Rvalue

$4.2/1 - "An lvalue or rvalue of type “array ofN T” or “array of unknown bound of T” can be converted to an rvalue of type “pointer to T.” The result is a pointer to the first element of the ...
Chubsdad's user avatar
  • 25.4k