Category "c"

Fastest Implementation of the Natural Exponential Function Using SSE

I'm looking for an approximation of the natural exponential function operating on SSE element. Namely - __m128 exp( __m128 x ). I have an implementation whic

First Not Repeating Character Code

Here is the question: Write a solution that only iterates over the string once and uses O(1) additional memory, since this is what you would be asked to do duri

OSError: [WinError 193] %1 is not a valid Win32 application while reading custom DLL in python with CTypes

I am trying to write code that wraps a C library in python. I am planning on using CTypes to do it and I used visual studio to compile my DLL. I started with a

Creating a file using fopen()

I am just creating a basic file handling program. the code is this: #include <stdio.h> int main() { FILE *p; p=fopen("D:\\TENLINES.TXT","r"); if(p==0) {

Bluetooth pairing in C blueZ on Linux

I cannot find any reference on how to pair a bluetooth device on linux in a program written in C using the BlueZ Bluetooth libraries. I already managed to do a

Get a List of Child Processes from Parent Process in C and C++ (Cross-Platform, No Command Line)

How to get a list of child process ID's from a given parent process ID in a cross-platform manner in C and C++ without using command line? I provided an answer

Get the beginning of a string until a given char

I know that is a simple question but I couldn't find the answer. I have this string: "M1[r2][r3]" I want to get only the "M1", I'm looking for something li

How to calculate power in C

How do I calculate a power in C, and do you have to include anything? I have tried to include math.h, however it didn't work. What is de difference between a in

C program to print a sentence using threads & semaphores with infinite loop

i am currently trying to make a programm which will print the sentece "What a wonderful world" using three threads. The first thread should print "What A" , the

Is it possible to program your own kbhit() in C?

I took a class of programming at my university and I am working on some program. I want to know if it is possible to program my own kbhit() function. And if it

Number of trailing zeroes

I've written a function trailing_zeroes(int n) that returns the number of the trailing zeroes in the binary representation of a number. Example: 4 in binary is

C Standard Library for Win32/Win64 other than MSCRT

In unix/linux world, there are a couple of different C Standard Library implementations to choose from and link against, but although I spent some time searchin

How can I pass and access C data from Java?

I've been doing some programming in Java and some in C but now I need to sort of use both together. Here's the situation, I'm using Hadoop/Hbase to process and

WebAssembly return string use C

How can I return a JavaScript string from a WebAssembly function? https://dev.to/azure/passing-strings-from-c-to-javascript-in-web-assembly-1p01 - not working

Read Key presses in C; ex.: Arrow keys, Enter key

I know how to use events to test when a key is pressed or not, but in C I never found out how to do that. What I want exactly is a "KeyListener" that listens fo

Define an "Unknown" or "NULL" value in an enum

I am defining a custom typedef Elements as follows.... typedef enum { Ar, Cl, F, He, H, Kr, Ne, N, O, Rn, Xe } Ele

How to solve error message "gcc‬: command not found" (only with arguments) on Ubuntu

I am working with Ubuntu 19.04 (Disco Dingo), and I have GCC installed. When I run gcc I am getting an error showing that I do have gcc: gcc: fatal error

Can we have recursive macros?

I want to know if we can have recursive macros in C/C++? If yes, please provide a sample example. Second thing: why am I not able to execute the below code? Wh

Debugging a driver with WinDbg - How set a breakpoint at DriverEntry?

I have a driver which is, for some unknown reasons causing a bugcheck 0x0000003b. So I decided to set up a Hyper-V VM and use kernel debugging to see what exa

Can x86's MOV really be "free"? Why can't I reproduce this at all?

I keep seeing people claim that the MOV instruction can be free in x86, because of register renaming. For the life of me, I can't verify this in a single tes