Stack Overflow » C Programming Questions
112 FOLLOWERS
Got a question related to C Programming and want to find a solution? You're at the right place. Ask questions and get advice/suggestions for the same here .Stack Overflow is the largest, most trusted online community for developers to learn, share their programming knowledge and build their caree
Stack Overflow » C Programming Questions
1h ago
I'm trying to set up a table of element associations, but I'm getting zeroed results. Here are the results:
Enter the equation (for example, N2 + H2 = NH3):
N2 + H2 = NH3
Total Terms in Equation: 3
Association between Terms and Unknowns:
N2, set 'a'
H2, set 'b'
NH3, set 'c'
Counted Atoms Table:
N: 3
H: 5
Table of Association between Unknowns and Elements:
Unknowns: a b c
N: 0a 0b 0c
H: 0a 0b 0c
I expected the last table to be filled out as follows:
Unknowns: a b c
N: 2a 0b c
H: 0a 2b 3c
Below is the function void printUnknownsTable() that prints the unknowns table.
// Function to print the ta ..read more
Stack Overflow » C Programming Questions
2h ago
Subject: Searching for Clarification on Using “printf() flags #”
Hello,
I am currently researching the use of “printf() flags #” in C programming. I refer to four different sources for information: cplusplus.com, en.cppreference.com, libc.pdf (especially section 12.12.5 on page 296) and C11 standard (section 7.21.6.1).
Regarding the use of “printf() flags #” I found the following statement:
“For a, A, e, E, E, f, F, F, F, g, and G conversions, the result of converting a floating-point number always contains a decimal point character, even if it is not followed by any digits. (Normally, a decim ..read more
Stack Overflow » C Programming Questions
4h ago
I have an ED25519 key inside an HSM and I want to use it to produce a self-signed X509 certificate.
I'm using OpenSSL version 3.3.0 to construct/produce the self-signed certificate. As far as I can figure out, the ED25519 key should be stored in an EVP_PKEY object, and I also need to implement a custom signing function (in the snippet bellow, it's the ed_meth_sign() function) and have an EVP_PKEY_METHOD pointing to it, then somehow, connect the EVP_PKEY object and the EVP_PKEY_METHOD objects so that my custom signing function is called when signing the X509 data object.
What I've done so far i ..read more
Stack Overflow » C Programming Questions
4h ago
I am creating a new kind of sandbox tool in Linux. My goal is to run un-modified binaries and have system calls intercepted by the kernel and sent to an alternative user-space process. I know seccomp with BSP filtering is capable of complex syscall filtering, but not sure if it can redirect to another process. I also know that hardware and software virtualization does something like this but I'm looking for an alternative to virtualization.
Does anyone know how to do this at a low-level without virtualization. By low-level I mean, not a whole sand-boxing solution like Docker. I'm thinking of a ..read more
Stack Overflow » C Programming Questions
4h ago
I dont know why but visual studio code keeps giving me this error. Why? How do I fix it?
1
I tried changing the type of the variable "z" in size_t from int but nothing changed.
Ignore this text (is here because a post should be at least 220 characters long ..read more
Stack Overflow » C Programming Questions
6h ago
I have function for changing sampling rate of audio (only one channel):
int change_sampling_rate(float *audio_input, int input_sample_rate, int output_sample_rate, int input_num_of_samples, float **audio_output, int *result_num_of_samples) {
AVChannelLayout src_ch_layout = AV_CHANNEL_LAYOUT_MONO;
AVChannelLayout dst_ch_layout = AV_CHANNEL_LAYOUT_MONO;
struct SwrContext *swr_ctx;
swr_ctx = swr_alloc();
int ret;
if (!swr_ctx) {
fprintf(stderr, "Could not allocate resampler context\n");
ret = AVERROR(ENOMEM);
}
av_opt_set_chlayout(swr_ctx, "in_ch ..read more
Stack Overflow » C Programming Questions
6h ago
The following code, written years ago in C, will not compile in the Community version of Microsoft Visual Studio for C++:
typedef struct {
char* szString;
int iID;
} LocalStringElement;
LocalStringElement l_sTheStrings[] = {
{"Simple", 0}, {"S", 0},
{"Triangular", 1}, {"T", 1},
{"Weighted", 2}, {"W", 2},
{"Exponential", 3}, {"E", 3}
};
Later on in the code it uses l_sTheStrings[some value].szString and l_sTheStrings[some value].iID, so it looks to be putting structures as elements of an array.
Using the C++ debugger gives, as an example,the following ..read more
Stack Overflow » C Programming Questions
6h ago
it is necessary to implement a structure with user input, an error occurs when executing a function at the place of assignment of subjects, there is a two-dimensional array, I do not understand what is wrong, I tried all the options, please help
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
char name[50];
char surname[50];
char subject[50][50];
int grade[50];
int numSubjects;
} Student;
void addStudent(Student* students, int* numStudents, char name[], char surname[], char subject[], int grade) {
strcpy(students ..read more
Stack Overflow » C Programming Questions
7h ago
it is necessary to implement a structure with user input, an error occurs when executing a function at the place of assignment of subjects, there is a two-dimensional array, I do not understand what is wrong, I tried all the options, please help
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
char name[50];
char surname[50];
char subject[50][50];
int grade[50];
int numSubjects;
} Student;
void addStudent(Student* students, int* numStudents, char name[], char surname[], char subject[], int grade) {
strcpy(students ..read more
Stack Overflow » C Programming Questions
7h ago
This post is hidden. You deleted this post just now. I am making a robot arm style device and controlling it with
Arduino Mega Nema 17 steppers 2004A LCD I2C 16 Button Keypad
I have several menus that are controlled by the updateMenuDisplay() function and are read from global arrays of strings.
I want to have the LCD screen work on all 4 lines and display 1 items per line. I cannot seem to prevent the menus from looping over and starting again from the beginning. This is especially annoying when you only have 3 items in a menu.
I know this is a simple logic problem really but i can't seem to g ..read more