+ 3

What is the problem in this program

https://code.sololearn.com/ci92YC4I8eiX/?ref=app

16th Nov 2019, 5:47 PM
👀 Sandy👀
👀  Sandy👀 - avatar
6 Answers
+ 3
the 13 line must be moved inside the loop block to allocate new memory each iteration also this instruction "temp = temp->rptr" should be removed in line 55 https://code.sololearn.com/cwBQV8TC9lED/#c
16th Nov 2019, 8:43 PM
MO ELomari
MO ELomari - avatar
+ 2
Tq ,bro But without temp the left is moves to other location so the left is changed We can't change the left We just printing the values
17th Nov 2019, 7:15 AM
👀 Sandy👀
👀  Sandy👀 - avatar
+ 1
17th Nov 2019, 7:45 AM
👀 Sandy👀
👀  Sandy👀 - avatar
+ 1
arguments are always passed to functions by value in C. in other words, when C passes control to a function, a copy of each argument is made and this copy is passed to the function - leaving the original variable unchanged. so if we change "left" of printl() to point something else then "left" of main() remains unaffected. in order to amend a variable in a calling function from within a called function, you need to pass a pointer to the variable as a function argument. this provides the called function with the memory address of the variable to be amended. dereferencing this (pointer) variable within the called function provides access to the original value: https://code.sololearn.com/cVu8SlIlU9a2/#c
17th Nov 2019, 12:22 PM
MO ELomari
MO ELomari - avatar
+ 1
Tq
17th Nov 2019, 5:47 PM
👀 Sandy👀
👀  Sandy👀 - avatar
0
hello
19th Oct 2020, 11:29 AM
Rani Roy
Rani Roy - avatar