I am new to programing, and I found one interesting but difficult to find reason problem, so I am writing this post. I was trying to write swap function: When I
I get rather poorly optimized assembly with gfortran 11.2 when using array pointers, even in seemingly very simple cases. For example, the optimized code (https
As Joel points out in Stack Overflow podcast #34, in C Programming Language (aka: K & R), there is mention of this property of arrays in C: a[5] == 5[a] Jo
I have a pretty simple python-3 code that is puzzling me. test.py : import numpy as np class PARTICLE: def __init__(self, PosV = np.zeros(3), Mass=0):
I am unsure what André Caron means here: Virtual functions in C ... some of this code relies on (officially) non-standard behavior that "just happens" t
I want to have a class with a constant pointer to a function as a member. However, I'm instead creating functions with constant return values (a strange feature
Im trying to implement a simple LinkedList class, but this error shows up and I don't understand why. struct Node { public: int val; Node* next; Nod
i have this typedef of two dinantial array, and strust the keep his adress typedef double mat[MAT_SIZE][MAT_SIZE]; typedef struct matList { char *name;
How can you pass a pointer to component 1 to component 2 (so that you can work with component 1 inside component 2, e.g. get its properties) <Component1 />
I was trying to visualize the algorithm of this exercise, but I'm having a lot of problems. the exercise asks to implement this function: extern const void *mem
I am new in Go world, the question could be obvious. Let's say I have a struct Example, which has some methods: type Example struct {} func (
C/C++ allows assigning values of a pointer to another pointer of the same type: #include <iostream> using namespace std; int main() { int* a = new i
I have a piece of software that generates a rather large text file full of information about files in a directory. There are often several thousand files. Each
I was reading C++ Is it possible to determine whether a pointer points to a valid object? and the correct answer in this thread is that no, yo
#include <stdio.h> int main(void) { int* ptr = NULL; *ptr = 10; printf("%d", *ptr); return 0; } I am very new to C programming and sorry
I was trying to access single bytes of an int value via the code below. My problem is that whenever I try to remove long int i=0; from the code, it gives me a s
I have two functions. One that returns the part of the string for me. Don't ask me why I'm doing it inside a function because I want to run this inside a thread
I have a struct typedef struct hash_entry_{ char *string; void *data; struct hash_entry *next; }hash_entry, *p_entry; I am referencing p_entry later i
I'm getting the error after I delete a pointer from the vector and try to delete a second one. I'm still new to pointers I created a base class of shapes and ha
#include <stdio.h> void hello() { printf("hello world\n"); } int main() { void *(*gibberish)() = (void *(*)())hello; (*gibberish)(); voi