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 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
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
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);
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
I'm attempting to do basic file reading in C with fgets. It should read one line, pass it to the tokeniser function which should split it at every ' ' and add
My box runs Ubuntu 21.10. I use GTK4, C-language and XML description of the GUI. I am new to GUIs in general, and to GTK4 in particular. The program uses a GtkF
For my studies, I have to write a C function GetEvenNumber: parameters: array with n integers + array size; returns tr array which contains even integers from t
I have a simple file reading algorithm but it's not returning the values that are in the file. The below is the code. The input txt values are 200 53 65 98 183
Project structure: enter image description here When starting the makefile, I get an error: src/main.c:1:10: fatal error: lib/hello.h: No such file or directory
why there is no "*" in output? the input is : abcde[enter key] #include<stdio.h> int main(void){ char ch; while ((ch=getchar( ))== 'e') pr
The question is pretty much in the title. The code void modify_str(char* str){ if(strlen(str) > 5) { str[5] = 'x'; } } Will invoke undef
FILE* inp; inp = fopen("wordlist.txt","r"); //filename of your data file char arr[100][5]; //max word length 5 int i = 0; while(1){ char r
NEC2 was originally written in Fortran and there have been two different ports to C from the original Fortran (xnec2c and necpp). The variable and function name
I'm trying to write a program that uses Caesar's algorithm to cipher a string input. I'm a beginner to C but I can understand basic codes. So to cipher the text
The following program checks if a signal is pending. I use the sigpending function to return blocked (or waiting) signals. The problem is that I don't want this
I'm new to C, and in order to practice I found a task on the Internet: Write C code that has functions that can: (1) Create a linear table; (2) Input data elem
I wrote the following code based of off Confusion about different clobber description for arm inline assembly and it works fine: #include <
I have the following code #include <stdio.h> //#define arraySize 5 #define arraySize 500 void func(double B[arraySize][arraySize]) { B[0][0] = 5; } i
While I practice C,I developed sample insertion sort in C. after some search and refer some materials ,I wrote following one. After that,I build and run. gcc in