My classmate asked me what language is the code I'm writing
Reddit » C Programming
by /u/harieamjari
36m ago
I was at school writing for a wrapper for a certain C library, when my classmate in the same course as Computer Engineering, asked me what language is the code I'm writing. It went like: Him: What language is the code you are writing? Me: C Him: Oh, C++? Me: No, C Him: Oh, C#? Me: No, Just C. [In a bit louder voice] Him: Ohhhh. Are people really this poisoined by the word, "C/C++/C#"? Is C really this underrated? submitted by /u/harieamjari [visit reddit] [comments ..read more
Visit website
Why does making my function 'inline' forces it to become an 'undefined reference'?
Reddit » C Programming
by /u/Gamerboy11116
36m ago
I have a file, 'bytes.h'. In it, I have a function declared and implemented called 'get_bit_u32'. The file 'bytes.h' is included in another file, '__all__.h', which is then included in 'main.c'. I noticed I kept getting this error: c:(.text+0x28): undefined reference to `get_bit_u32' collect2.exe: error: ld returned 1 exit status But my #pragma message for the file 'bytes.h' always went off. Weirder, all the other things I've declared and implemented in 'bytes.h' get included successfully and I can use them no problem. It's only that one function that can't be found. But for whatever reason ..read more
Visit website
Need helppp
Reddit » C Programming
by /u/Impressive_Pay_7596
9h ago
so i am a student an got an assignment to program an online bookstore system using c program the specification is to make sure that the staff can edit like adding or delete product.. for that part i have no problem but.. am wondering if i wanted to make that its already have some product at the start so my question is how to do that and also to edit that in the program submitted by /u/Impressive_Pay_7596 [visit reddit] [comments ..read more
Visit website
GUI in c
Reddit » C Programming
by /u/KMC_PO_PMC
21h ago
Hey guys, I feel like I just crossed this line where I can start building my first projects. I wanted to implement the GUI for my project in C. Are there any useful guides, courses, videos, articles, etc. that could help me understand how to work with the GTK library (this is the most popular one as far as I know)? Maybe you have other recommendations regarding this matter. I look forward to your advice. submitted by /u/KMC_PO_PMC [visit reddit] [comments ..read more
Visit website
Best practice for creating a TCP server that can handle multiple clients?
Reddit » C Programming
by /u/house_of_klaus
1d ago
I'm currently in the design phase of a TCP server that I'm trying to build for school. I'm hung up on whether or not I should be using a thread pool, poll(), or a combination of the two? What are the pros and cons of each, and what factors help determine what methodology to use? submitted by /u/house_of_klaus [visit reddit] [comments ..read more
Visit website
How can I write a program that takes control of the computer's Chipset?
Reddit » C Programming
by /u/taM608
2d ago
I want to write a program in C language that controls the chipset part of the computer and controls the hardware such as cpu, ram and performs various operations. How can I do this or is it possible to do this? submitted by /u/taM608 [visit reddit] [comments ..read more
Visit website
C calling free twice
Reddit » C Programming
by /u/ChernoKarim
2d ago
Why it's not a good practice to call free() a lot of times after allocating a pointer with malloc(), calloc(). I search about that but i don't get a good explanation yet for this issue. And what happen exactly when you free a pointer from the heap memory. And why we should set pointer to null after freeing it to free it again. submitted by /u/ChernoKarim [visit reddit] [comments ..read more
Visit website
How would you structure a game written in C?
Reddit » C Programming
by /u/Spirited_Ad1112
2d ago
I have very limited understanding of programming in general and the differences between procedural and object-oriented programming, so please forgive my ignorance. While I know how to do basic stuff, I believe not knowing how to structure things (in this case, a game) is holding me back from progressing. I have made Snake in C using Raylib, where the game loop has to specifically update the snake and the food generator. I'm thinking of going one step further for the next project, and have something that is more scalable. I have previously made an application in C#, but not using proper GUI fr ..read more
Visit website
Memory leak that I do not understand
Reddit » C Programming
by /u/JustNormalRedditUser
2d ago
FILE *numeriPari(FILE *src, FILE *dest) { char *ptr; char *buf = malloc(128); //memory leak here according to Clion int tmp, i, val, j, k, n, power, m; i = val = j = k = 0; n = power = 1; rewind(src); rewind(dest); while ((tmp = fgetc(src)) != EOF) { if (i == 128 * n) { ptr = realloc(buf, 128 * ++n); //mem leak also here if (ptr == NULL) { free(buf); exit(EXIT_FAILURE); } buf = ptr; ptr = NULL; } buf[i++] = tmp; } n = 0; while (i >= 0) { while (--i >= 0 && !isspace(buf[i])) n++; m = i; while (j++ < n) { while (k++ < n - j) power *= 10; val += (buf[++m] - '0') * power; pow ..read more
Visit website
Best way to make a non const copy of const pointer
Reddit » C Programming
by /u/dimonium_anonimo
2d ago
I've got a function that takes in as a parameter a const int32_t *p that I'm using to initialize a structure to some default values. If I just make a direct copy struct_name->table = p; The compiler hits me with a "warning: assignment discards 'const' qualifier from pointer target type." So if I cast it to non-const first struct_name->table = (int32_t*)p; It gets rid of the warning, but then SonarCloud says "cast from 'const int *' to 'int *' drops const qualifier" Is there a way to soothe both at the same time? What's the best practice here? submitted by /u/dimonium_anonimo [visit red ..read more
Visit website

Follow Reddit » C Programming on FeedSpot

Continue with Google
Continue with Apple
OR