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.
405,490
questions
-1
votes
0
answers
20
views
C performance is worse than node.js in software shader for the linux framebuffer, what is happening? How to improve it?
I would expect for C to be way faster than node.js, but in my application it does not.
I am trying to do a simple software shader animation that changes the linux framebuffer:
In C (out of desperation)...
0
votes
0
answers
56
views
Arguments inside a C function
I am recently studying functions in C and I often notice (from online examples) that function in the main.c contains arguments with a different name than what they are called in the file in which it ...
0
votes
0
answers
19
views
Why are my arduino pins not activated after the first main loop?
Below is a description of what the Arduino should do, however I found that after the first loop in main, the pins are not activated again:
The mainRoutine function retrieves the current time from the ...
0
votes
0
answers
10
views
arduino ide gives "invalid operands (*ABS* and .text sections) for `<<'" error
this line of code that gives error:
ldi r20, (1 << SCK_PIN) | (1 << MOSI_PIN) | (1 << CSN_PIN) | (1 << CE_PIN) | (1 << LED_PIN)
and the compile gives this error:
Error: ...
0
votes
0
answers
19
views
Is it possible to make a C++ application and use Flutter as the GUI framework?
I have made a C++ application that runs on embedded linux (OrangePi) and currently it uses a HMI screen (Nextion). But this really ties me to a specific brand of screen and the features that they ...
1
vote
2
answers
47
views
Why does this assembly implementation of strcmp behave unexpectedly?
I've been writing my own naive implementation of the strcmp function in x86_64 assembly.
I've written a c test program to compare the behavior with the real strcmp from the C library.
Even if both ...
2
votes
0
answers
34
views
String allocated on the heap is corrupted when being accessed outside of the function C
I was trying to write some code in C to replace a substring in a given string following this tutorial. I managed to get it working, however one of the problems with the function is that it will result ...
-2
votes
1
answer
64
views
In C, 31 characters of an internal name are significant; what does that mean? [duplicate]
I'm a novice programmer who started learning C. While I'm reading a book (C Programming Language, 2nd edition), I've stumbled upon a paragraph that says,
At least the first 31 characters of an ...
-1
votes
0
answers
23
views
Configuration in task.json and launch.json in Vs Code for showing execution time in terminal after running
I am a complete beginner in this, with the help of Chatgpt i configured my task.json and launch.json (i have no idea what are they), the programs are running fine but the terminal is not showing ...
-2
votes
0
answers
77
views
Pointer "ptr + offset" vs "&ptr[offset]" [closed]
Consider a piece of code in C as shown below
int arr[1000];
int offset = 500;
int *ptr_array = (int *)&arr[0];
int *ptr_temp1 = ptr_array + offset; // ---> method-1
int *ptr_temp2 = &...
-1
votes
0
answers
39
views
To remove a nth node from the end of a linked list i have written this program
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
int isfound(struct ListNode* head, int i );
int isfound(struct ListNode* head, ...
0
votes
1
answer
26
views
APUE, Why MAXSLEEP defined value, divided by 2
In APUE, in figure 16-11, the code is as follows:
#include "apue.h"
#include <sys/socket.h>
#define MAXSLEEP 128
int connect_retry(int domain, int type, int protocol, const struct ...
-2
votes
0
answers
38
views
Xor combinations to get: 0x32 address [closed]
Given the foolowing hexa addresses in 32bit memory:
0x0000520 0x08040010 0x08040020 0x08040028
and an additional value to my choice (which can't include 00, for example 0x32 is prohibited and 0x1002 ...
0
votes
0
answers
31
views
Variable optimization in c [closed]
In c program if I use one variable frequently in arithmetic operation I heard about it going to optimized by compiler. but I don't know how it going to optimize and where that variable going to kept ...
0
votes
1
answer
37
views
Undefined refenrece after importing static library in C
I have a static library built from another project and I want to use it in new project.
My CMakeLists.txt:
cmake_minimum_required(VERSION 3.0)
project(smah)
add_library(lotrlib STATIC IMPORTED)
...