Category "c"

Enumerate all binary numbers of length n and weight at most k lexicographically

I'm looking for an algorithm which enumerates all binary numbers of a given length n lexicoraphically, with the constraint that every number is skipped, which h

C Problems with fscanf

Thanks for all the answers, after the corrections the code did not work for a stupid error ... I opened both files with the same file pointer "database" ... I'

May a compiler store function-scoped, non-static, const arrays in constant data and avoid per-call initialization?

In reading How are char arrays / strings stored in binary files (C/C++)?, I was thinking about the various ways in which the raw string involved, "Nancy", would

Interesting C macro, how is it able to take a field within a struct and return a reference to the struct?

I saw an interesting design for a doubly-linked-list inside the Pintos operating system and I don't quite understand how it was able to achieve this behavior. I

Can substitute PyCharm Professional for CLion - primarily for python

My favourite editor by far is PyCharm, mainly because I am most comfortable with Python. I am subscribed to the professional package, but I am interested in pi

Unable to stop a C program with infinite loop and printf within on macOS

#include <stdio.h> int main(void) { while(1) { printf("!"); } return 0; } This is my program. When I run it in the terminal, I can't

"C programming language" - Counting characters anomaly?

In The C Programming Language book by Ritchie & Kernighan, in §1.5.2 Counting Characters, two versions of the program are given: #include <stdio.h

addressSanitizer: heap-buffer-overflow on address

I am at the very beginning of learning C. I am trying to write a function to open a file, read a BUFFER_SIZE, store the content in an array, then track the cha

Query RTC and NTP time in Linux?

The way the Linux kernel handle time is somewhat complicated as it uses different source of time, and regularly resynchronize everything. There are command-line

C11 variadic macro : put elements into brackets [duplicate]

I'm looking at a macro, or more likely a combination of macros, that would achieve the following effect : BRACKET(a) => { a } BRACKET(a

Why can low priority processes affect the latency of an high priority process?

I have tested the rt process's latency by cyclictest. And found that when I launch a few lower priority rt processes(priority is 40) the high priority rt proces

How to Fix: Error: Segmentation Violation and IncludePath Needs to be Updated from Debugger

I am working with ROOT and have ROOT installed in my computer. I am writing my code using Visual Studio. In my code I have the following header files: #include

What is the best way to pass parameters to a callback function? (C/C++) [closed]

I'm learning SDL right now and I'm trying to use timer callback function. The function SDL_AddTimer() offer me only one argument to pass throu

Fatal error in avr-gcc, specifies incorrect MCU

I am learning to program my ATtiny85 without a bootloader using a MiniPro, and I want to generate a hex file. First I try to compile my file using the avr-gcc c

Cache Simulator in C - Why am I getting a 'hit' every time?

I am writing a simple cache simulation in c. I'm somewhat of a noob when it comes to c but I have the program almost entirely working I think. For some reason i

debug an array of linked lists in c

I'm having a trouble in my project, at first I made one linked list and it worked properly but then I had to edit it and make it an array of linked list, but it

When I call the C system() function, is the location of the new program's main() stack frame similar to the original program's main() stack frame?

I'm wondering if when I call the C system() function, the location of the new program's main() stack frame is similar to the original program's main() stack fra

How do I decrypt with openssl something encrypted with cbc_crypt (xencrypt)?

In a database there is string encrypted with glibc's xencrypt which is using internally cbc_crypt and the decryption was happening with xdecrypt function which

statvfs wrong SD available size returned

I'm trying to monitor the available SD card size in a embedded linux system (petalinux). After looking for this topic around stackoverflow I learn that a good

Codeblocks 16-bit message

enter image description hereI'm new in Codeblocks and programming world. ( Unsupported 16-Bit Application The program or feature "\??C:\Users\Hossen\Desktop\C