Top "C" questions

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

`getchar()` gives the same output as the input string

I am confused by a program mentioned in K&R that uses getchar(). It gives the same output as …

c eof getchar
Is ncurses available for windows?

Are there any ncurses libraries in C/C++ for Windows that emulate ncurses in native resizable Win32 windows (not in …

c++ c ncurses
How to use glOrtho() in OpenGL?

I can't understand the usage of glOrtho. Can someone explain what it is used for? Is it used to set …

c++ c opengl
C Macro definition to determine big endian or little endian machine?

Is there a one line macro definition to determine the endianness of the machine. I am using the following code …

c architecture macros endianness
What does AND 0xFF do?

In the following code: short = ((byte2 << 8) | (byte1 & 0xFF)) What is the purpose of &0xFF? Because other …

c bit-manipulation bitwise-operators bit-shift
How can one grab a stack trace in C?

I know there's no standard C function to do this. I was wondering what are the techniques to to this …

c windows debugging cross-platform stack-trace
The ternary (conditional) operator in C

What is the need for the conditional operator? Functionally it is redundant, since it implements an if-else construct. If the …

c operators ternary-operator conditional-operator
Expression must be a modifiable L-value

I have here char text[60]; Then I do in an if: if(number == 2) text = "awesome"; else text = "you fail"; and …

c char variable-assignment lvalue
Clang vs GCC for my Linux Development project

I'm in college, and for a project we're using C. We've explored GCC and Clang, and Clang appears to be …

c++ c linux gcc clang
Is multiplication and division using shift operators in C actually faster?

Multiplication and division can be achieved using bit operators, for example i*2 = i<<1 i*3 = (i<<1) + i; …

c++ c division multiplication bit-shift