I have a struct that will contain some dynamic-allocated array. I have written the following code, and it works but I do not understand why it does w ...
I have a struct that will contain some dynamic-allocated array. I have written the following code, and it works but I do not understand why it does w ...
I wrote this code to remove all occurrences of x from the string using recursion however it's pass by value and If I try using pass by reference it ...
I'm getting multiple errors.. I've tried this with different variables and different data types. I clearly don't understand how to use pointers proper ...
I am passing in a reference to a pointer variable into a function. The function will do something and point the pointer variable to some object. Code: ...
In the following code I try to compare a vector of pointers via find_if and determine which contains a member a == 5 (in this case both of course, but ...
Header file: circlehead.h C FILE1: circle.c MAIN FUNCTION circle_main.c I have linked the files into a single executable: But I am getting ...
I have recently had a class about structures in C and the lecturer used the expression "pass by reference" to describe the action of passing a pointer ...
I need this functionality to pass both dynamically allocated array and idx to a function and assign values to it. Segfault is occuring when I try to a ...
I am passing a pointer to a function with intent of modifying the data kept at the original address. I am able to get the desired output using this ...
The partial code, in C, is here: I am confused about how the deleteList function is working. So the arguement is a pointer to a pointer to a List s ...
Here is the simple code: The output is unexpected. The first cout prints an address that looks like a address but the cout that is in the main prin ...
For Leetcode question 1312 ,I implemented a pass by value solution and my execution time for a testcase was above 120ms, for the same test case in a p ...
I though that I understood iterators and addressing etc. but obviously not. See my below code below which is purely an example. I need to be able to ...
C++ allows pass by reference, but not in C. Questions is, how can C function be used to update the reference to array of struct passed by pointer. M ...
I am working on a project which requires certain actions be in their own functions. Right now, I must take the random values generated, and output the ...
I want to craete a single linked list without gloabal variables. I initialized the first element with NULL and then wanted to copy the first element n ...
in this function the last line is printing the correct value. But here I'm getting some garbage value. I know what the problem is, I know why it ...
I have an struct variable which is passed like as follows: Here, when I run this in gdb, and step into function1(), I see for variable aVAR one tem ...
As the title describes, I am trying to pass the pointer to the data of a std::vector into a function expecting a double pointer. Take as an example th ...
Not sure if the terminology in the title is 100% correct, but what I mean is easily illustrated by this example: This will print But what if I ...