Category "c"

format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘int *’

Each time I submit a program on hackerrank the following error occurs. solution.c: In function ‘main’: solution.c:22:14: warning: format ‘%d

Pass char* array from c dll to python

I have simple dll with function which taks callback as parameter and calls it sometimes passing unsigned char* array. I want to use it in python. Here is dll so

strdupa() implementation for Visual C

I am trying to port a C (not C++) program from GCC to Visual Studio. The GCC specific function strdupa() is widely used in this program. Is there any way to imp

Python's C extension with more than one header

I have been updating a Python package developed in Python 2.7, so far so good until I got to the C extensions. My C (plib.c) file imports the classes below: #in

Stack smashing detected when allocating array C [closed]

As the title explains the problem. In this function in my program , whenever I allocate a certain size in the array I get huge chunks of error

Find the maximum, minimum, and average values in the array

In my code, the program will not allowed the negative number entered, the program will stop reading, then calculate the maximum value, minimum value and average

Win32 raw input blocks input locale switching when RIDEV_NOLEGACY is specified

I'm writing a keyboard input system for Windows based on Raw Input. It is implemented with RIDEV_NOLEGACY flag set, and legacy keyboard messages are generated m

Attempting to compile with my own static C library

I compiled a static library. I have two files. mylib_1.c with function foo1 in it mylib_2.c with function foo2 in it. Both #include "mylib.h". I compiled a libr

"fatal error: bits/libc-header-start.h: No such file or directory" while compiling HTK

I'm getting the following issue when trying to run make on the HTK library: (cd HTKLib && make HTKLib.a) \ || case "" in *k*) fail=yes;; *) exit 1;;

Write a macro function to change the case of a string?

// I tried this code #include<iostream> using namespace std; // Function to convert characters // of a string to opposite case #define case_change(s

Why does CMake set -no-fat-lto-objects when I enable LTO/IPO?

I'm enabling IPO (inter-procedural optimization) for a C compilation of mine, using CMake: set_property(TARGET foo PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)

An integer array of up to 10 integers is read. Negative integers are not allowed to read

My program only allows positive integers up to 200 to be entered. -1 and the rest of negative numbers are not allowed to be read, and for safety, the 10th digit

Fscanf Doesn't Take Inputs properly

I'm trying to take inputs with fscanf and to give output to another file but fscanf doesn't give the input it should give. Here is my code: #include <stdio.h

Two different answers for same expression in C

I have an expression which does the same calculation. When I try to do the whole calculation in a single expression and store it in variable "a", the expression

Cython how to create an anonymous union inside of a struct?

I want to create the following structure in cython (actually I don't really need this one in but it is a simplified example.) cdef struct MyStruct: int x

What are 'objects' in C language?

In the book, Modern C by Jens Gustedt, following statements have been made by the author: In the following subsections, we will introduce the syntactical aspec

For LOOP throw away by Compiler optimization

I was doing an experiment to measure the execution time of ''for loop'' on microcotroller. This ''for loop'' contain some integer and pointer operation. Case 1

How to print QR code (or bitmap) to thermal printer?

I'm working with software that runs on linux/windows and also android. On linux and windows, it prints QR codes by generating a bitmap and sending via ESC * to

ESP32 AWS IoT transportStatus=-1

I'm following the espressif docs for connecting a ESP32 to AWS IoT shadow. I'm using the example github.com/espressif/esp-aws-iot for shadow mqtt synchronisatio

C Producer-Consumer Using PThreads

I am working on a problem where I am implementing a program that mimics the producer-consumer paradigm. The code that I am using works when I only have one prod