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
I already know that there is no way to know if a pointer target still a valid allocation of it's already freed, so I'm trying to use pointer to pointer to solve
I want to pass and return a 2D array of unknown size but I donot know how to do it. I know how to only return array of unknown size only (array of pointers). I
For example: temp->next = NULL is same as (*temp).next = NULL list->next->next = temp is same as ??
I have learned that pointers can be declared in 3 different ways: int* a; int *b; int * c; I prefer: int* a; While declaring a pointer to a structure, is it c
In my function, a memory pointer and its size are passed as parameters: int myFun(uintptr_t* mem_ptr, int mem_size) { // Code here } Is there any way to te
#include<iostream> #include<vector> using namespace std; int main(int argc,char** argv){ int n; if(argc>1) n=argv[0]; int* stuff=new int[n];
I do a pokemon project with a Qt interface. I created a class Trainer and Pokemon : class Pokemon { protected: string itsName; doub
As you can see it is giving me 1 but why? When i do t-p then it gives me -1 . Why ? int f=4, o=8; int *p, *t; p = &f; t = &o; printf("Difference betwee
Is there a concept like a pointer to a string in javascript? Or how would this be done? let s1 = "hi"; let s2 = "bye"; // I want to write my code like this [,]
I'm trying to create a program which the user inputs the number of items (rows) and give each one of them a name (scanf) with the max of 30 characters. I want t
I'm trying to get a better understanding of the C standard. In particular I am interested in how pointer arithmetic might work in an implementation for an unusu