Category "c"

Can i use interrupts in inline assembly

I want to use interrupts in inline asm but it is not letting me I think my app is this __asm__("movb %ah,9;" "movb %al,0x41;" "movb %bh,0x0;" "movw %cx,0x1;

How to work with Ukrainian (or Russian) letters in C language?

Good day to all)) The task is as follows: "Enter the entered Ukrainian (or Russian) sentences into a singly linked list organized as a queue (only addresses sho

How to install OpenMP on Mac M1?

I am currently studying to become a computer engineer and I need to work with OpenMP. After some research, I'm still having trouble installing it (#include <

Can I use printf in an Android native binary

Let's assume the phone is rooted and arm binaries can be installed. Can I make a console binary using Android Studio with printf output? Is there a step-by-step

C flexible array define with another type instead of malloc

the general usage of flexible array is to use malloc to define the flexible array. I'm trying to explore defining the flexible array with another struct. An exa

Gurobi model Heap has been corrupted

I am using Gurobi (9.0.3) C API to build a LP model and change the constraints to get different objective value. However, sometimes when I run the code, there i

Why is conversion from string constant to 'char*' valid in C but invalid in C++

The C++11 Standard (ISO/IEC 14882:2011) says in § C.1.1: char* p = "abc"; // valid in C, invalid in C++ For the C++ it's OK as a pointer to a String Lit

While building GCC 8.5.0: "error: `CC' has changed since the previous run"

I'm building GCC 8.5.0 on a Devuan Chimaera GNU/Linux system (using GCC 10). I've configured with ./configure --disable-gnat, then ran make. At some point, I ge

Why the unary * operator does not have a constraint "the operand shall not be a pointer to void"?

C2x, 6.5.3.2 Address and indirection operators, Constraints, 2: The operand of the unary * operator shall have pointer type. Why there is no constraint "the o

What is the rationale for "structure with flexible array member shall not be a member of a structure"?

C11, 6.7.2.1 Structure and union specifiers, Constraints, 3 (emphasis added): A structure or union shall not contain a member with incomplete or function type

How to write "#pragma twice" preprocessor in C?

We know there exists #pragma once which prevents source file to be included more than once, but how to make preprocessor (with conditional compilation) which pr

Does the read () system call clear the stdin buffer when it is called after getchar()?

The following output seems to suggest that when read () is called after a getchar() it clears all the stdin. Let's say that I typed "Hello\n" : char buff; int c

How can I build the file in C++ with wiringPi?

I am trying to run an example program from the wiringPi in C++ in Geany software(called blink.cpp) This is the code (I did not do it, I took it directly from t

How to free a malloc 2D array in C initialiszed in this way?

I have declared a 2D malloc array like this in C: int** pArray; int i; pArray=(int**)malloc(pRows*sizeof(int*)); for(i=0;i<pRows;i++)

I'm having a problem creating a linked list [duplicate]

#include<stdio.h> #include<stdlib.h> void insert_front(struct node* head, int block_number); void insert_rear(struct node* head,

getchar() keeps returning EOF even after subsequent calls but read() system calls seem to "clear" the stdin. What are the reasons behind this?

char buff[1]; int main() { int c; c = getchar(); printf("%d\n", c); //output -1 c = getchar(); printf("%d\n", c); // output -1 int re

I am trying to add two strings together but getting 3221225477 Error

I am trying to get a number and a repetition number then adding as many numbers as the number of repetition one after the other. But I am getting 3221225477 res

Have to hit enter twice with fgets() in C?

Good Morning, I'm having an issue with some C code where I am forced to hit enter twice each time input is entered if the length of the input is less than the s

Can Valgrind mend memory corruption?

I am testing a C++ program for problems. I am running it under valgrind. I start the program with // valgrind test char * p = (char*)malloc(4);

Register external C library to avoid incorrect diagnostics / treesitter highlighting in neovim

I want to write a C file + get correct diagnostics and tree-sitter syntax highlighting in neovim. Everything works fine, unless I include an external library (i