Category "c"

anything wrong with this trim() method in C

this method is for trimming a string in C by deleting spaces from the beginning and end. BTW iam not that good with C and actually facing some issues with deald

Why can't i use the € symbol with printf?

How can i put this symbol (€) on the terminal using c. I've tried: printf("%c",0128); 0128 is the code on the ascii table but the compiller gives the error

Different behaviors between C and Rust code snippets

I have a C code snippet which uses pipe() and fork() to communicate between parent and child process. I want to replicate it in Rust. For the POSIX APIs used in

how to set Trap flag (TF=1) in c language or assembly?

I used xinu and i want to use single step Interrupt (01H). I have two questions does TF flag equal 1 (TF==1) when xinu system initialize ? if no then how i can

C double to long conversion loses value in some cases - why?

I have the following code, which is causing me a weird double to long conversion problem. Under the hood, logCpof just writes to a special log file, using vpri

using a string to reference a struct

I'm having troubles with a function in C using a string to reference a struct, the used code is included below int Search_name (char nombre[],Nentrada user_numb

Meaning of int a[10]; int *p = a+9;

I am currently trying to understand pointers in C but I am having a hard time understanding this code: int a[10]; int *p = a+9; while ( p > a ) *p-- = (

Are defined strings set to all NULLs?

I could have sworn that I read that a string that was defined but not initialized was set to all NULLs. In other words, that char string[10]; consisted of 10 n

Split a text using different delimiters

long time no coding in c and i'm a bit in trouble. I get tex from a file formatted like that: # 3 10 P1 16 3 P2 8 1 P3 10 2 from the second line every line re

puff.c How does the huffman decoding work?

I am trying to decompress a raw DEFLATE data stream in order to understand, how the DEFLATE decompression works. I don't care for performance at the moment. I j

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