Top "C" questions

C is a general-purpose programming language used for system programming (OS and embedded), libraries, games and cross-platform.

What is the difference between a static global and a static volatile variable?

I have used a static global variable and a static volatile variable in file scope, both are updated by an …

c static global interrupt volatile
How do you query a pthread to see if it is still running?

In my destructor I want to destroy a thread cleanly. My goal is to wait for a thread to finish …

c multithreading concurrency pthreads destructor
File Operations in Android NDK

I am using the Android NDK to make an application primarily in C for performance reasons, but it appears that …

c file-io java-native-interface android-ndk
Can't compile C program on a Mac after upgrade to Mojave

I have used the gcc command on the terminal to compile C programs but all of a sudden, after an …

c macos gcc terminal
How to build x86 and/or x64 on Windows from command line with CMAKE?

One way to get cmake to build x86 on Windows with Visual Studio is like so: Start Visual Studio Command …

c visual-studio cmake cross-compiling x86-64
Reading long int using scanf

To read an int using scanf we use: scanf("%d", &i); What if i is a long not int?? …

c++ c stdin scanf
Why does strncpy not null terminate?

strncpy() supposedly protects from buffer overflows. But if it prevents an overflow without null terminating, in all likelihood a subsequent …

c strncpy
C - scanf() vs gets() vs fgets()

I've been doing a fairly easy program of converting a string of Characters (assuming numbers are entered) to an Integer. …

c scanf fgets gets
How to use fread and fwrite functions to read and write Binary files?

Hi in my project I've to read a .bin file which has sensor data in the form of short(16 bit …

c binaryfiles fwrite fread
Invalid read of size 8 - Valgrind + C

Valgrind reports error Invalid read of size 8 in the following code. I have an array declared like, struct symbol *st[…

c valgrind