Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [c]

C is a general-purpose programming language used for system programming (OS and embedded), libraries, games, and cross-platform. This tag should be used with general questions concerning the C language, as defined in the ISO 9899 standard (the latest version, 9899:2018, unless otherwise specified — also tag version-specific requests with c89, c99, c11, etc.). C is distinct from C++, and it should not be combined with the C++ tag without a specific reason.

0 votes
0 answers
7 views

K&R recommends the use of int when reading character using getchar()? [duplicate]

The problem is distinguishing the end of the input from valid data. The solution is that getchar returns a distinctive value when there is no more input, a value that cannot be confused with any real ...
The beginner guy's user avatar
-1 votes
1 answer
15 views

Populating two arrays from a CSV file with each row containing two words separated by a semicolon

How could I fix my code that populates two separate arrays from a CSV file that contains words separated by semicolons in C? My CSV file looks something like this: to meet/encounter;begegnen to care ...
Daniel's user avatar
  • 1
0 votes
0 answers
21 views

Problem With Adding SFML 2.6.1 To Dev C++ (Linker Error)

I'm trying to add SFML 2.6.1 to Dev C++ (I use Windows 7). I added lib and include to Libraries and C++ Includes in Compiler Options; and added "-lsfml-graphics -lsfml-window -lsfml-system" ...
Skywater's user avatar
0 votes
1 answer
57 views

Weird timings when measuring the perfomance of binary search [closed]

Okay, so what is happening here puzzled me for 2 days. Basically, as an activity I was measuring how much time some algorthim takes to execute in its worse, average, and best cases. Until now, I got ...
Vulgo's user avatar
  • 25
-4 votes
0 answers
35 views

Question about the address change in dynamic array unexceptionally [closed]

Basically, the program manages storage placed in memory. Each chunk has a header including all the details about the chunk, including size and the next chunk. I create a struct header to store all ...
qiu shi's user avatar
1 vote
0 answers
18 views

Broken pipe error with Ports between Elixir and C [closed]

I am attempting to write a program in Elixir that connects to a C program via Port and erl_interface. I got the C code up and running and managed to send data through the port as well as decode and ...
hilbor's user avatar
  • 45
0 votes
4 answers
57 views

How does 'long double' occupy 16 bytes / 128 bits of storage when my CPU (X64 ISA)?

I'm a novice C programmer; this might be a naive question to ask but please bear with me. I learnt that the storage size of char, short, int, long, long long, float, double, and long double are ...
Greeshma's user avatar
0 votes
2 answers
33 views

Is it possible to define a macro that checks if a value falls within value range for any given sequential enum?

Given an enum which is assigned sequentially (i.e. the first value is 0 and the last value is the number of enumerations - 1), we can check if a value is a valid enum value like so: enum e {FOO, BAR, ...
You'reNotARobot's user avatar
0 votes
2 answers
67 views

How can i make a C program exit when key Q is pressed?

i am making a counting program, and i want to add a feature that quits the program, but i don't really know how to do it. i have seen examples on how to do it, but all of them are for windows. please ...
Yakov Kotsarenko's user avatar
0 votes
1 answer
46 views

Why does printing cause the heap break to increase by this much?

I wrote the following program, #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <time.h> #include "rand.h" int main (int argc, char* argv[]) { ...
Addem's user avatar
  • 3,823
1 vote
0 answers
14 views

Does the EVP_KEY created by OSSL_DECODER_CTX_new_for_pkey need to be manually freed?

Does this code (ignoring lack of error handling) leak with OpenSSL 3.0? EVP_PKEY *pkey = NULL; BIO *public_key_file = BIO_new_file("public.pem", "r"); OSSL_DECODER_CTX *dctx = ...
OrangeDog's user avatar
  • 38.2k
1 vote
0 answers
13 views

Clang error: libdnk.a, libunwind.a and libc++.a linkage issues in windows build

I am trying to build an ELF file using the ARM-M4 toolchain version 8.1.0. My C code files compile successfully, but I encounter the following error while linking the object files [100%] Linking C ...
user2986042's user avatar
  • 1,174
2 votes
3 answers
64 views

Read is blocked by getc

For the following code: #include <unistd.h> #include <stdio.h> int main() { char buf[6]; printf("%c\n", (char)getc(stdin)); int ret = read(STDIN_FILENO, buf, 5); ...
Wei Li's user avatar
  • 1,905
2 votes
1 answer
31 views

LNK2019 unresolved external symbol in function defined in static library

I am trying to compile a driver through the use of cl.exe on Windows 10. It is written in pure C. I am using the Enterprise Windows Driver Kit to provide source files and compiling for X86. I ...
amm's user avatar
  • 23
0 votes
1 answer
58 views

In C language, do multiple implicit conversions that occur in an expression have a certain order? [closed]

(My question might be quite long. I would be very grateful if you could read it through.) I am learning C language by reading the C11 standard. I find that there are quite a lot of implicit ...
user24723440's user avatar

15 30 50 per page
1
2 3 4 5
27038