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.

-1 votes
1 answer
82 views

Why lines variable is 0?

I've created wc like program and when i tried to do line counting, it shows as 0. The code: #include <stdio.h> #include <stdlib.h> FILE* file; int main(int argc, char* argv[]) { //...
TeenProgrammer's user avatar
1 vote
1 answer
46 views

Redirect stdout in unit testing with ctest

Writing unit test with ctest. The function to test is doing printout to stdout/stderr. So, right now, I am having: typedef struct { char *stdout_file; char *stderr_file; } test_config; static int ...
White Owl's user avatar
  • 357
0 votes
0 answers
14 views

Issue with Cache Way Partioning on Raspberry Pi5 - A76/DSU

I am attempting to get Cache Way partitioning to work on the Raspberry Pi-5 using the process defined here https://developer.arm.com/documentation/100453/0401/L3-cache/L3-cache-partitioning?lang=en. I ...
Cole Strickler's user avatar
0 votes
1 answer
73 views

First Hello World in C using MacOS and the terminal prompt

I´m doing my first program in C and I don´t now how to compile it to show the message in the terminal. #include <stdio.h> #include <stdlib.h> int main() { printf("Hello World!\n&...
Mateo Rendon's user avatar
0 votes
1 answer
70 views

Should Portable Types Be Used in the Declaration of a Main Function? (C11)

This question came to me last night, and I couldn't find a definitive answer in my brief surf of Google. Should (or could) I use portable types (i.e int32_t) in the declaration of my program's main ...
Zenais's user avatar
  • 108
0 votes
3 answers
83 views

Trying to read txt file line by line in C Language

Basically my input file is in the format: I 15 3 15 10 10 20 S -5 3 15 82 I -20 80 -4 10 S 4 -20 8 The number of ints in a row can vary, but there is always one char at the beginning of each ...
Neel Varma's user avatar
0 votes
0 answers
27 views

pwntools p32(arg1) got issue when arg1=10, maybe because 0xa

I was tring to learn stackoverflow so I wrote me a program, here's the source code: # include <stdio.h> void pwn(int a, int b) { printf("Pwned! arg1 = %d, arg2 = %d\n", a, b); } ...
winny's user avatar
  • 1
2 votes
0 answers
41 views

ESP32 FreeRTOS crashes when calling callback between tasks

I'm trying to implement the observer pattern on ESP32H2 device (devkit) ESP-IDF v5.2.1. I have 2 FreeRTOS tasks (in 2 files), there is a register callback function in one file, which is used to pass a ...
valeroso's user avatar
1 vote
0 answers
15 views

How to auto move GtkWindow on current focused workspace?

I'm trying to automatically move the window to the focused workspace. That is, when I change the workspace, the Gtkwindow will automatically move to that workspace. I tried the script below but it is ...
dibyendu's user avatar
  • 165
1 vote
2 answers
52 views

Analog data operations do not work in PIC12F675, there is not even a reaction on GPIO pins

This Analog data is read and the number 1-5 is shown on the 7 segment common anode display with 7447, but I can't set this number for analog value because I can't show analog values or output I wrote ...
CrazyProgrammer's user avatar
1 vote
0 answers
50 views

Why are the __bss_start and __bss_end names NOT addresses?

I'm building for a Xilinx 7000 Zynq dual ARM processor. I thought the linker was gnu, but now I'm not sure whether it is or not. I can create a memory section in the linker script, with something like ...
Rich's user avatar
  • 193
0 votes
1 answer
39 views

function to return number of characters in n line of a file return always those of line 2 in c

the function is supposed to return the length of a line specified by the 2nd argument but the result is either 0 or the one in the 2nd line whatever n may be: int line_length(const char *filename, int ...
Pepe Cuesta's user avatar
2 votes
1 answer
87 views

Return an array of objects from a C function? [duplicate]

I'd like to know how to return an array of objects from a C function. Here's an example: SDL_Vertex initTriangle (struct Point2D point1, struct Point2D point2, struct Point2D point3) { SDL_Vertex ...
spots 727's user avatar
1 vote
0 answers
41 views

AVX512 duplicate low 256 bits into high 256 bits inside a zmm register

Is there a faster way to duplicate (copy) the low 256 bits of an AVX-512 register into the higher 256 bits than using the _mm512_insertf64x4 instruction? My current solution is: __m512d zmm1 = ...
Tomas's user avatar
  • 71
1 vote
0 answers
36 views

Correct Method to Place Multiple Arrays in a Custom Flash Section in C using GCC

I need to store a constant array in flash memory at a specific location using GCC in my embedded C project. For a uint32_t value, I managed to do it like this, and it works: const uint32_t ...
WITC's user avatar
  • 197

15 30 50 per page
1
3 4
5
6 7
27039