Category "c"

Why the use of getch() shows error?

struct node { int data; struct node *next; } *start=NULL; void create() { char ch; do { struct node *new_node,*current;

print fibo big numbers in c++ or c language

I write this code for show fibonacci series using recursion.But It not show correctly for n>43 (ex: for n=100 show:-980107325). #include<stdio.h> #in

Why is ANSI printing the code the first time the function is called and printing colours the second time around?

I am trying to change the colour output of my printf statements in a connect 4 game. I have made a function to set the print colour and reset it. It works for m

How to create a new text file in C?

I am creating a program which reads data from one text file and changes it size to upper or lower case and then stores that data in a new file. I have searched

How to create 24 bit unsigned integer in C

I am working on an embedded application where RAM is extremely tight. For this purpose I need to create a 24 bit unsigned integer data type. I am doing this us

How can I include a C header that uses a C++ keyword as an identifier in C++?

I've been using C++ and compiling with clang++. I would like to include the <xcb/xkb.h> header for an X11 program I am writing. Unfortunately this header

How to reset this string scanning code for a new letter?

I'm in the middle of homework and nearly finish. This is my code #include <stdio.h> #include <stdlib.h> void main() { char word[100],*ptr,input

C print first million Fibonacci numbers

I am trying to write C code which will print the first 1million Fibonacci numbers. The actual problem is I want to get the last 10 digits of F(1,000,000) I unde

Using setjmp and longjmp with a local jmp_buf

In the case that a local jmp_buf is actually represented by registers rather than stack memory, is it possible for setjmp or longjmp to cause the contents of th

OpenCL - clEnqueueNDRangeKernel - output array becomes input array

I perform a 5-point stencil operation on a 2D array until getting a convergence computed on this 2D array. So I have multiple iterations (until convergence) and

How to set up Raspberry Pi 4B as a I2C slave

I'm trying to set up a RPi 4B to work as an I2C slave with PSoC (4.4) - CY8C5888LTI-LP097. Below is my code to set up the slave address on the Pi. import pigpio

I can't figure out why it works half the time

My own minesweeper I am trying to make #include <time.h> #include <conio.h> #include <stdio.h> #include <stdlib.h> int randNum(int min

Reading multiple lines in C using fscanf

i'm currently doing an uni project which has to read a multiple lines sequence of inputs given in a .txt format. This is my first experience with C, so i don't

Anaconda confuses C/C++ linker with duplicate libraries

This is happening on a Linux system. Anaconda comes with several C libraries, like libz, or libgomp. I have most of these libraries also installed globally on m

How to get the time difference between two times (24h format)

I am currently trying to create a program where the user gives two values (times, hh:mm:ss) and gets the difference between the two times. This works, if one wo

How to export matlab matrix to .txt in a format supported by c

As I state in the title, I want to export a matrix from matlab to a .txt file in format that is supported by C. What I mean is something like this { { 1, 2, 3,

configure: error: cannot run C compiled programs

I'm trying to install different software onto my Raspberry Pi with Debian Wheezy OS. When I run try to configure software I'm trying to install I get this outpu

UEFI function running wrong part in if else

I am writing a UEFI function which used to show status. But when I give it a EFI_STATUS type "2" as "state" argument, it execute "else" part, instead of "state

Why is socket linger used after socket close?

I looked at documentation about this but shouldn't a socket linger be declared before the close so the program doesn't immediately abort before it knows what ki

stm32-h743zi nucleo-144 ADC

i have a problem with getting value from ADC on the nucleo144 board. I connected a potentiometer to the pin A0, but the ADC is stuck in the HAL_PollForConversi