Top "C" questions

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

How to compare a char?

I am learning c. I have a question. Why doesn't my program work? #include<stdio.h> #include<…

c char conditional-statements assignment-operator
How to resolve: "cast to pointer from integer of different size" warning in C code?

I am removing gcc warnings from a legacy code. Is it possible to suppress the warning "cast to pointer from …

c pointers gcc-warning
Mapping a numeric range onto another

Math was never my strong suit in school :( int input_start = 0; // The lowest number of the range input. int input_…

c math arduino
How to solve "ptrace operation not permitted" when trying to attach GDB to a process?

I'm trying to attach a program with gdb but it returns: Attaching to process 29139 Could not attach to process. If …

c linux debugging gdb strace
What kind of data type is "long long"?

I don't know this type. Is that the biggest one from all? I think it is an integer type, right? …

c objective-c long-long
Are there any downsides to passing structs by value in C, rather than passing a pointer?

Are there any downsides to passing structs by value in C, rather than passing a pointer? If the struct is …

c struct parameter-passing abi
Getting absolute path of a file

How can I convert a relative path to an absolute path in C on Unix? Is there a convenient system …

c unix path filesystems absolute
Why do I get a segmentation fault when writing to a "char *s" initialized with a string literal, but not "char s[]"?

The following code receives seg fault on line 2: char *str = "string"; str[0] = 'z'; // could be also written as *str = 'z' …

c segmentation-fault c-strings
Including a header file from another directory

I have a main directory A with two sub directories B and C. Directory B contains a header file structures.…

c compiler-errors include c-preprocessor
Passing multidimensional arrays as function arguments in C

In C can I pass a multidimensional array to a function as a single argument when I don't know what …

c function multidimensional-array