Top "C" questions

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

Going through a text file line by line in C

I have been working on a small exercise for my CIS class and am very confused by the methods C …

c getline scanf
Convert hex string (char []) to int?

I have a char[] that contains a value such as "0x1800785" but the function I want to give the value …

c char int
How do I fix "for loop initial declaration used outside C99 mode" GCC error?

I'm trying to solve the 3n+1 problem and I have a for loop that looks like this: for(int i = …

c gcc for-loop
What is the LD_PRELOAD trick?

I came across a reference to it recently on proggit and (as of now) it is not explained. I suspect …

c linux environment-variables
Is bool a native C type?

I've noticed that the Linux kernel code uses bool, but I thought that bool was a C++ type. Is bool …

c gcc linux-kernel boolean
How to use shared memory with Linux in C

I have a bit of an issue with one of my projects. I have been trying to find a well …

c linux fork shared-memory
How do I use valgrind to find memory leaks?

How do I use valgrind to find the memory leaks in a program? Please someone help me and describe the …

c valgrind
Checking for NULL pointer in C/C++

In a recent code review, a contributor is trying to enforce that all NULL checks on pointers be performed in …

c++ c if-statement null coding-style
Is there a good Valgrind substitute for Windows?

I was looking into Valgrind to help improve my C coding/debugging when I discovered it is only for Linux …

c windows debugging memory-leaks valgrind
Difference between char* and const char*?

What's the difference between char* name which points to a constant string literal, and const char* name

c pointers constants