Skip to main content
Filter by
Sorted by
Tagged with
Advice
0 votes
5 replies
47 views

For my little business, im looking for a solid service to receive sms online for account verifications. tried a few like smsfast and free-sms-receive,(something like that, don't really remember) but ...
0 votes
0 answers
73 views

I'm making a library function to measure text. However, it can't take a PangoLayout or anything to do with Pango except the font used. My current solution is just to create one for use specifically ...
Coarse Rosinflower's user avatar
2 votes
2 answers
130 views

I'm asking this question from the perspective of a compiler developer – I want to know whether a particular potential optimisation is valid (because all programs that the optimisation would break have ...
ais523's user avatar
  • 2,751
-6 votes
2 answers
306 views

I want to try catch the free(hello); so that the free(world); can still be executed for freeing all allocated memory in the main program. int main() { const char *hello = "Hello World"; ...
stackbiz's user avatar
  • 1,960
4 votes
2 answers
238 views

I don't know how to reset the value field inside the Hello struct. It's a pointer pointed to an outside passed input argument. typedef struct Hello { void *value; } Hello; Hello* create_hello() { ...
stackbiz's user avatar
  • 1,960
2 votes
3 answers
218 views

I want to write a computer programme that will do the following things : 1a. It will make an array 3 characters long. £££ 2a. It will then initialize the array with the string "{_}" and ...
uran42's user avatar
  • 775
3 votes
2 answers
186 views

Is it safe to call free in the example below: size_t len = 10; char* buffer = static_cast<char*>(malloc(len)); std::string_view sview(buffer, len); free(sview.data()) Why do I need this? I have ...
Njrslv-yndx-cloud's user avatar
0 votes
2 answers
170 views

I am confused about &str[0], which is equal to str. If I can do str = NULL, why can’t I do &str[0] = NULL or why does it not work? Also, since free(str) and free(&str[0]) both work to free ...
iliass's user avatar
  • 19
3 votes
2 answers
138 views

I've been following an article that walks through implementing primitive versions of malloc and free. After finishing the allocator, I wanted to test it using Valgrind, so I added the following lines ...
younessBct's user avatar
1 vote
2 answers
130 views

I'm not sure why my valgrind is spitting heap errors and I've been tracing my code left and right. I have some code, but I'm not sure if more code is needed. My jobs.h #include "piper.h" #...
minyoung heo's user avatar
3 votes
1 answer
122 views

I'm just confused as to why this keeps giving me an error. If I just fread the file in and don't assign the last index to the null terminator, I can free the memory after using it. However, if I do ...
Aidan's user avatar
  • 87
5 votes
6 answers
915 views

Suppose that I need to malloc three times and I would like to make an early return if one of the malloc calls have failed. My first try: void test(void) { int *a, *b, *c; a = malloc(sizeof(*...
Doohyeon Won's user avatar
1 vote
0 answers
86 views

I am trying to implement a simple memory allocator. Essentially trying to copy the function malloc() and free(void *ptr) in C. I initialize a region of memory using sbrk(). In my custom malloc ...
Kamrul Hassan's user avatar
1 vote
1 answer
146 views

I am writing some random code and I wanted to know if there is there anything that defines how freeing memory returned like this works or if it is just undefined behavior. struct a *get() { static ...
FenrirBots's user avatar
0 votes
2 answers
164 views

The following code allocates 256 bytes for a character array and then replaces the space with \0 (similar to what strtok and strsep do). #include <stdlib.h> #include <string.h> int main() ...
9-Pin's user avatar
  • 482

15 30 50 per page
1
2 3 4 5
174