Skip to main content

All Questions

Tagged with
16votes
7answers
41kviews

What is the difference between a pointer pointing to 0x0 location and a pointer set to NULL?

Is a pointer pointing to 0x0000 the same as a pointer set to NULL? If NULL value is defined in the C language, then what location does it physically translate to? Is it the same as 0x0000. Where can I ...
1vote
4answers
748views

Passing arrays as global variables instead of pointers in C

I'm required to write the Low-Level Requirements of a Software Component which shall perform signal processing over arrays of 200k elements of integers/floats which lives in the main memory of the ...
0votes
1answer
402views

Implement Dependency Inversion in C with UML diagram

As per Robert C. Martin in Clean Architecture, he gives a simple UML diagram to illustrate Dependency Inversion. To put it simply, HL1 initially referred to ML1 without interface to invoke F() ...
0votes
1answer
79views

Avoiding repeating code when assigning pointer addresses based on branch

I have the following code in C that reads data off a char array and makes decisions on what variables should some pointers point to. char preset1[20]; char preset1Name[20]; int preset1Temp; int ...
0votes
1answer
111views

Is it safe to make training data and labels as global variables in C?

I'm trying to make this function called walk in C. The idea is that the function takes as parameters a point in space (represented by an array), a function (pointer), and a step size / learning rate ...
27votes
11answers
16kviews

Isn't the use of pointer variables a memory overhead?

In languages like C and C++, while using pointers to variables we need one more memory location to store that address. So isn't this a memory overhead? How is this compensated? Are pointers used in ...
54votes
9answers
53kviews

Why are pointers not recommended when coding with C++?

I read from somewhere that when using C++ it is recommended not to use pointers. Why is pointers such a bad idea when you are using C++. For C programmers that are used to using pointers, what is the ...
5votes
2answers
4kviews

Type safety - GO vs C pointers

C is a static-typed language that is not type-safe, because pointers(void *y) let you do pretty much anything you like, even things that will crash your program. GO is also a static typed language ...
13votes
4answers
3kviews

How is precedence determined in C pointers?

I've come across two pointer declarations that I'm having trouble understanding. My understanding of precedence rules goes something like this: Operator Precedence ...
0votes
1answer
122views

What design pattern (if so) did I apply? How can I further improve it?

Suppose I have a program.c that needs element_123 to do some operations, and element_123 can be accessed by including agent.h /*program.c*/ #include "agent.h" uint32_t element_123 = 0; ...
-2votes
2answers
182views

What is the correct use of -> operator when working with pointers?

I'm pretty new with C so I have encountered many doubts with pointers. I've already search a lot about this but there are some things that still are not clear for me, and I also think this will help ...
7votes
4answers
924views

Autoreleasing objects in Reference Counting Systems

I'm experimenting a bit in C and I'm trying to implement my own Reference Counting System. I've mainly worked with Objective-C in the past but AFAIK autoreleasing objects is something that is unique ...
6votes
1answer
8kviews

What is the motivation for casting a pointer into a integer?

I'm doing some changes in the Linux kernel code and have noticed a pointer being cast into integer. Check out buf below (full code): snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *...
92votes
16answers
21kviews

Do the young minds need to learn the pointer concepts?

Why did the C master Dennis Ritchie introduce pointers in C? And why did the other programming languages like VB.NET or Java or C# eliminate them? I have found some points in Google, and I want to ...
3votes
4answers
20kviews

usage of double pointers and n pointers?

I am familiar with basic C pointers. Just wanted to ask what is the actual use of double pointers or for that matter n pointer? #include<stdio.h> int main() { int n = 10 , *ptr , **ptr_ptr ;...

153050per page
close