1 votes 1 votes The following C function rearranges the members of a single-linked list of integers that is passed as a parameter. The list of numbers 1, 2, 3, 4, 5, 6, and 7 in the specified order is passed to the function when it is called. How many components will move about in the list once the function is finished running? Programming in C programming-in-c made-easy-test-series data-structures linked-list + – Souvik33 asked Jan 11, 2023 Souvik33 776 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes I’m getting the answer as ‘2’ , but the given key is ‘6’ and the final list is “ 2, 1, 4, 3, 6, 5, 7 ” Can anyone please help, what’s going wrong, thanks Souvik33 answered Jan 11, 2023 Souvik33 comment Share Follow See all 2 Comments See all 2 2 Comments reply Sunnidhya Roy commented Jan 11, 2023 reply Follow Share @Souvik33 use precedence rule in line 20, it will be like: q = (p ? (p --> next) : 0) Isn't it? = has the lowest precedence here so it will be computed last. The list after running the rearrange method will become 2 1 4 3 6 5 7 so 6 elements are not in their position. 2 votes 2 votes Souvik33 commented Jan 11, 2023 reply Follow Share q = (p ? (p --> next) : 0) Thanks @Sunnidhya Roy for this you are right. 😊 Very good section to do silly mistake ↓↓ 2 votes 2 votes Please log in or register to add a comment.