Category "c"

Creating multiple threads in C

I am just a beginner in Programming using C.For my college project I want to create a multi-threaded server application to which multiple clients can connect an

Move file pointer to the end

I am trying to make a students details record program in c wherein I will store all the data in a file. I will provide the user with options such as entering a

Convert Base 16 (Hexadecimal) to Base 36 String in C

In C, what's an efficient way to convert a 64 character hexadecimal number (as a string) into a base 36 string? I mean, is it as easy as combining a few GLIB2

Question about sharing mmapped area between 2 different processes

I'm trying to share mmapped area in 2 processes. In my program, I create memory_update() process and memory_read() process. This memory_update() process update

Compiler does not support 64-bit integers on target Architechture

I am new to MPLAB XC8 compiler and don't know why this error is happening as I did not use any number that is of 64 bit in my code. Code is as follow #include &

Print the numbers 1 to 100 using 5 semaphores and processes

I have an assignment to write a program in c language that will print to the shell the numbers 1 - 100. I must use 5 processes. The first one will print 1, 6, 1

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