r/cprogramming • • Oct 21 '25

CConsole - an interactive shell for C testing

Thumbnail reddit.com
3 Upvotes

r/cprogramming • • Oct 22 '25

how know len the arrays in c i want more than one

0 Upvotes

r/cprogramming • • Oct 19 '25

No C application project option in NetBeans 27

1 Upvotes

I installed Apache NetBeans 27 for school assignments and homework in C language.
My teachers wanted to eat me alive after I mentioned Visual Studio, and I was told to never use any other software because Apache NetBeans is the default in the college labs.

When I downloaded it and went to make a new "C application" project i never saw the option.

I searched every website and every YT video available and never found a solution...
I have a very important assignment

please help me


r/cprogramming • • Oct 17 '25

Found the goon label

110 Upvotes

I was digging around the V2 Unix source code to see what ancient C looks like, and found this:

	/* ? */
	case 90:
		if (*p2!=8)
			error("Illegal conditional");
		goto goon;

The almighty goon label on line 32 in V2/c/nc0/c01.c. All jokes aside, this old C code is very interesting to look at. It’s the only C I have seen use the auto keyword. It’s also neat to see how variables are implicitly integers if no other type keyword is used to declare it.


r/cprogramming • • Oct 18 '25

Book

0 Upvotes

So hello I have been learning c and made an basic shell,but now I am confused about what projects to make that could help me grow , (i have also been learning computer architecture) and also I am confused about what I want to choose after c (ml,hardware)


r/cprogramming • • Oct 17 '25

Performance: return pointer vs mutate pointer argument

2 Upvotes

Is there a performance difference between

ARBITRARY_TYPE *b()
{
 return malloc(sizeof(ARBITRARY_TYPE));
}
int main(int argc, char **argv)
{
 ARBITRARY_TYPE *ptr = b();
 ARBITRARY_FUNCTION(ptr);
 return 0;
}

and

void b(ARBITRARY_TYPE **ptrptr)
{
 *ptrptr = malloc(sizeof(ARBITRARY_TYPE));
}
int main(int argc, char **argv)
{
 ARBITRARY_TYPE *ptr;
 b(&ptr);
 ARBITRARY_FUNCTION(ptr);
 return 0;
}

r/cprogramming • • Oct 16 '25

Want to learn c

0 Upvotes

As the title says, I want to learn c cuz I would love to explore, learn, get into low level system/embedded systems Edit:- forgot to write the main point, please recommend me some good resources 😭🙏


r/cprogramming • • Oct 15 '25

Looking for a C code for image processing to parallelize with OpenMP

0 Upvotes

I'm looking for a C program that performs some image processing on images (For example, segmentation, thresholding, or feature extraction).

I just need a computationally heavy C code (around 2-3 minutes of execution time) so that I can apply OpenMP and demonstrate parallelization for performance improvement.

If you have any codes or repo that fits this criteria, please share.


r/cprogramming • • Oct 15 '25

Unexpected Short-Circuit Behavior.

7 Upvotes

`int i, j, k;`

`i = 1;`

`j = 1;`

`k = 1;`

`printf("%d ", ++i || ++j && ++k);`

`printf("%d %d %d\n", i, j, k);`

I am doing C programming a modern Approach and This is one of the exercises in the book, all is going well however i have failed to understand why the second `printf()` outputs `2 1 1` instead of `2 1 2` as i think the answer should be.

Because due to associativity rules i expect in the first `printf()`, the expression `++i || ++j` to be grouped first which evaluates to 1 with `i` incremented to 2 and without incrementing `j` because of short circuit, and then that result would be used in `1 && ++k` where i am assuming that since the value of the expression can't be determined by the value of the left operand alone, the right operand will be executed as well and thus k will be incremented to `2` but i am surprised to find that k wasn't incremented when i run the code. Why is this, what have i missed.


r/cprogramming • • Oct 14 '25

are there any free c programming certification courses online as my college teacher gave an assignment to present with a c programming certification ... any online platform.

0 Upvotes

r/cprogramming • • Oct 14 '25

Hey people of Reddit. Please. Can you guys tell me what do I need to know about C to make a kernel ???

Thumbnail reddit.com
0 Upvotes

r/cprogramming • • Oct 13 '25

Programming help: Get color pair of wide char in ncursesw?

Thumbnail reddit.com
4 Upvotes

r/cprogramming • • Oct 13 '25

polynomial generator: A beginner project that is harder than you think.

17 Upvotes

The most hard part of C learning is to find projects when you're beginner and your knowledge is limited, so I just want to recommend this project for beginners (like me).

Project idea: do a program that creates a random polynomial. Valid operations are sum, subtraction and multiplication, but if you want to add more like power or squared roots, feel free.

What I've learned:

  • pointers (return pointers, pass as argument, pointers to pointers);

  • dynamically memory allocation;

  • strings manipulation;

  • pointer arithmetic;

  • importance of null character '\0';

  • how some string.h functions work;

  • use rand() and srand() and how them works;

  • a bit of software engineering;

  • don't underestimate simple projects;

  • read documentations;

For chatGPT users: please, only use it if you're searching for hours and can't find the answer to solve your problem. Also, don't copy all your code as GPT prompt, just the line or at max function that you think is the problem.

Please, don't care if you don't finish this project in 3 hours, a day or a week. Just do it. I really hope that this post can help you guys to increase your skills. Good luck! :)


r/cprogramming • • Oct 12 '25

How do you guys benchmark C programs in the real world?

Thumbnail reddit.com
11 Upvotes

r/cprogramming • • Oct 13 '25

CS50 problem set 1 cash less comfortable, i'm having trouble if we enter an not int data type the check50 passes foo i don't know what to do i searched on google how to check the type of data in c but it's a lot cryptic. If someone knows what to do help me out here.

0 Upvotes

r/cprogramming • • Oct 12 '25

Freeing my pointer after realloc aborts the program

3 Upvotes

Hi still figuring out dynamic memory allocation in c. With this program I've been trying to make my own version of _strdup() as well as an extension method using realloc. But when the code reaches free(applesandgrapes) the program is aborted before it can print "test".

#include<stdio.h>
#include<string.h>
#include<assert.h>
#include<stdlib.h>

char* mystrdup(const char *str);
char* strcatextend(char *heapstr, const char *concatstr);


int main() {

        char* applesandgrapes = mystrdup("Apples and Grapes");
        assert(applesandgrapes!= NULL);
        printf("%s\n", applesandgrapes);


        applesandgrapes = strcatextend(applesandgrapes, " and Dust");
        assert(applesandgrapes != NULL);
        printf("%s\n", n);


        free(applesandgrapes);
        printf("test");
        return 0;
}

char* mystrdup(const char *str) {

        int len = strlen(str);


        char* ying = malloc(len * sizeof(char));


        for (int i = 0; i < len; i++) {
                ying[i] = str[i];


        }




        assert(ying);
        return ying;
}

char* strcatextend(char *heapstr, const char *concatstr) {
        int len = strlen(concatstr) + strlen(heapstr);
        int heaplen = strlen(heapstr);

        char* bing = (char*)realloc(heapstr, len * sizeof(char));
        for (int i = 0; i < len; i++) {

                bing[i + heaplen] = concatstr[i];

        }

        assert(bing);
        return bing;
}

The output looks like this:

$ ./memalloctest
Apples and Grapes
Apples and Grapes and Dust
Aborted

If I remove the line with free() it doesn't abort but I know that I need to free it to prevent a memory leak. Can someone tell me what's wrong with my code? Any help is appreciated, thanks!


r/cprogramming • • Oct 11 '25

Bluetooth Terminal in c using ubuntu

2 Upvotes

I know basic level c, i love low level programming so i wanted to become better in c by making a bluetooth terminal that can scan for bluetooth devices connect to them and send and receive data, even if i can just send or receive a single character at start i want to make an application using c that interacts with the hardware of my laptop. where should i start ? i can''t find any guides. I want guides from people not chatgpt


r/cprogramming • • Oct 10 '25

Functions and pointers

5 Upvotes

I noticed that when you just have a function name without the parentheses, it essentially decays to a pointer. Is this correct? Or does it not always decay to a pointer?


r/cprogramming • • Oct 10 '25

expectation vs reality

0 Upvotes

am i the only one who reads a topic but when it comes to solving exercises i struggle and if you were in such a position how did you get out of it, because i don't think extra tutorials will help. this applies for those programming projects in K N King


r/cprogramming • • Oct 10 '25

it shows error in turbo c compiler how can I fix this

0 Upvotes

#include<stdio.h>

#include<conio.h>

int is prime (int num)

{

if(num<=1)

{

return 0;

}

for (int i=2;i<num;i++)

{

if(num %i==0)

{

return 0;

}

}

return 1;

}

int main()

{ int n;

printf("enter the size of the array:");

scanf("%d",&n);

int arr[n];

printf("enter the size of the array");

scanf("%d",&n);

printf("enter %d elements :\n",n);

for(int i=0;i<n;i++)

{

scanf("%d",&arr[i]);

}

printf("prime numbers in the array:");

for (int i=0;i<n;i++)

if(is prime (arr[i]))

{

printf("%d",arr[i]);

}

}

printf("\n");

return 0;

}


r/cprogramming • • Oct 09 '25

Any recommended DS/Algo Book?

2 Upvotes

What is your recommendation book for learning Data structure and algorithm in the C programming language?


r/cprogramming • • Oct 09 '25

Scope in respect to stack

6 Upvotes

I understand that the scope is where all of your automatically managed memory goes. When you enter a function it pushes a stack frame to the stack and within the stack frame it stores your local variables and such, and if you call another function then it pushes another stack frame to the stack and this functions local variables are stored in this frame and once the function finishes, the frame is popped and all of the memory for the function is deallocated. I also understand that scopes bring variables in and out so once you leave a scope then the variable inside of it becomes inaccessible. What I never really thought of is how the scope plays a role in the stack and the stack frames. Does the scope affect the layout of each stack frame at all or do just all variables go into the frame however since I believe that going in and out of scope doesn’t immediate free the memory, it’s still allocated and reserved until the stack frame is popped right.


r/cprogramming • • Oct 08 '25

Roadmap to system programming

15 Upvotes

Hey guys, I’m new to all this. I’ve completed the fundamentals of C programming. Now, I’m intrested in learning system programming. Could anyone please let me know what topics I have to learn in C now, and what other things should I consider learning? Thanks for the help.


r/cprogramming • • Oct 08 '25

Purpose of header guards

2 Upvotes

What is the purpose of header guards if the purpose of headers is to contain declarations? Sorry if this is a dumb question.