Category "c"

I have an unexpected buffer overrun warning, why do I have that?

I have to create a function that sum components of a vector this way: first + second, third + fourth, 5th + 6th, and so on. original vector has size "size". I h

stdin to an emscripten, about how to continue input?

related to Providing stdin to an emscripten HTML program? function stdin() { if (i < input.length) { var code = input.charCodeAt(i); +

What will be the run time if a function is defined inside a program but is not called in main function?

I am doing all my assignments in a single .c file by writing functions, but now it seems that it affects the run time. Does it mean that if I do not call a func

Why macros and functions work differently about same code in c

I am new to programing, and I found one interesting but difficult to find reason problem, so I am writing this post. I was trying to write swap function: When I

Why function pointer in the structure causes relocation at program load-time

I've the following code that I compile and run on Linux: #include <stdio.h> // can't be static void do_stuff(void) { ;; } typedef void (*func)(void)

Is it safe to use printf("%*s", len, ptr) where len is an integer and ptr is non-null terminated?

Is it safe to use printf("%*s", len, ptr) where len is an integer and ptr is non-null terminated? If not safe, what will happen in the worst case? And then how

RT linux jitter when receive UDP after upgrade kernel from 3.14 to 5.10

We have an old product that running Linux 3.14 Preempt kernel, One application keeps polling field devices one by one: send one UDP packet to one IP then sleep

My constant is changing, and I dont know why, or even how

I'm making a program that basically "ciphers" a text, by substituting the letters by other ones. So you basically run the program and enter a distribution, then

How input format affect the storage of input in c [closed]

I used scanf("%d , %d",&a,&b); and tried to sum a and b. It gave 2 + 3 = 339 but it gave right input with scanf("%d %d",&a,&b)

Change style of GtkLabel inside header bar

I am trying to add a GtkLabel to the right of a GtkHeaderBar then change the font weight but I cannot manage to do it. I have my XML like this: <?xml version

Change style of GtkLabel inside header bar

I am trying to add a GtkLabel to the right of a GtkHeaderBar then change the font weight but I cannot manage to do it. I have my XML like this: <?xml version

/usr/bin/cat: -: Bad file descriptor when using pipe()

I am recreating a complete shell. For that I must simulate "|". To do this, I have to use the dup2(), fork() and pipe() functions. here is my code : void do_pip

error: invalid application of 'sizeof' to incomplete type

In a header file, foo.h, I have something like: extern const int array_foo[]; Then in a source file, foo.c, I have something like: const int array_foo[] = {1 ,

Does the code load the data on the linked list?

Does the code load the data on the linked list? and the printing method to verify that the data is present in the linkedlist, is it correct? This is the data fo

Stack balanced Parentheses build log show :- Process terminated with status -1073741510 (0 minute(s), 2 second(s))

When I try to implement parenthesis problem using stack (array representation) it showing above problem. Here I use dynamic memory allocation in array. When I

Gstreamer x264enc invalid buffer size c

I've been trying to use this gstreamer c code(my system is running on ubuntu 20.04 with GStreamer 1.16.2 and gcc 9.4.0): #include <gst/gst.h> #include <

Get window from XEvent

I'm struggling figuring out how to obtain the window a specific event was triggered from. What I want to achieve is the following: Capture XCursorNotifyEvent Fi

With arrays, why is it the case that a[5] == 5[a]?

As Joel points out in Stack Overflow podcast #34, in C Programming Language (aka: K & R), there is mention of this property of arrays in C: a[5] == 5[a] Jo

Compiles in CMD line fine with GCC but Visual studios "expression must have constant value" [duplicate]

As title states the code compiles and outputs in the GCC just fine, I want to step by step follow the code in visual so I can make sure I full

C Program, printf() and strlen() argument format for output

Why does my terminal crash when I attempt to run this C Program? Here are the instructions for the programming exercise. #include <stdio.h> #include <