pass-by-pointer Questions

6

Solved

A simple question for which I couldn't find the answer here. What I understand is that while passing an argument to a function during call, e.g. void myFunction(type myVariable) { } void main() ...
Delinda asked 19/1, 2014 at 10:10

3

Solved

I've never used std::get_if, and since its name is different from std::get, I don't see a reason why its argument should be a pointer¹ (whereas std::get has a by-reference parameter). ¹If it was n...
Tracee asked 21/9, 2021 at 14:41

2

Solved

What is the meaning of Value semantics and Pointer semantics in Go? In this course, the author used to mention many times about above terms when explaining internals of arrays and slices which I co...

6

Solved

Let's consider an object foo (which may be an int, a double, a custom struct, a class, whatever). My understanding is that passing foo by reference to a function (or just passing a pointer to foo) ...
Incogitant asked 21/10, 2016 at 21:26

10

Solved

I'm really new to Swift and I just read that classes are passed by reference and arrays/strings etc. are copied. Is the pass by reference the same way as in Objective-C or Java wherein you actuall...
Mckenzie asked 8/12, 2014 at 18:6

2

Solved

Not sure if the terminology in the title is 100% correct, but what I mean is easily illustrated by this example: class MyClass{ String str = ''; MyClass(this.str); } void main() { MyClass ob...
Fibrinolysin asked 21/3, 2019 at 9:4

1

Solved

Suppose I have a program like this: #include <iostream> #include <string> #include <vector> // Takes values and outputs a string vector. std::vector<std::string> foo(const...
Flavine asked 11/2, 2019 at 11:19

2

Solved

I'm trying to make a very simple program that modifies arrays, but ran across some interesting behavior if I converted them to types. https://play.golang.org/p/KC7mqmHuLw It appears that if I have ...

5

I was told to avoid using pointers in C++. It seems that I can't avoid them however in the code i'm trying to write, or perhaps i'm missing out on other great C++ features. I wish to create a clas...
Counterpoison asked 15/10, 2015 at 13:33

2

I have a function which accepts a vector<vector<MyClass>> and modifies the MyClass instances. It's been a long time since I've written any C++ and I'm having difficulty remembering ...
Crackbrained asked 25/5, 2015 at 19:55

3

This question is intended as a follow up question to this one: What are the differences between a pointer variable and a reference variable in C++? Having read the answers and some further discuss...

3

Solved

I'm trying to get a deeper understanding on pointer arguments in functions for C. I've written a test program to try to see the difference between passing a single pointer vs a double pointer to a ...
Haversack asked 3/8, 2014 at 17:8

4

Solved

I have a function that takes a double pointer to a struct and assigns a value. However I get an "access violation writing location ..." when trying to access the member member1. This is my code: s...
Heretic asked 1/10, 2013 at 8:10
1

© 2022 - 2024 — McMap. All rights reserved.