Category "c"

Create a linked list with the characters of a string-C90

The problem : I am trying to create a linked list which contains the characters of a string in each field of the linked list(to get the distance of each letter

perf mem doesn't records mem load on heap

I used perf mem on my test C program, because I want to get how many times the mem load(and store) on the same pages. a. My C program is here: "stest.c" #includ

I’m trying to sum the return value of 2 threads together but it return -1 saying error

I’m trying to make a program which sums the numbers in an array, the first half of the array by the first thread and the second half by the second thread

Time Complexity of Split AVL Tree Function

I have the following code for splitting the AVL tree and I'm not quite sure if it has Time Complexity of O(log(n)) or O((log n)2). Note: The Complexity of join

errno vs errors returned by library functions

For errno, there are a bunch of library functions, like strerror(), etc. to convert or print the error code. But what about the error codes re

How to know if the file end with a new line character or not

I'm trying to input a line at the end of a file that has the following shape "1 :1 :1 :1" , so at some point the file may have a new line character at the end o

How to get the i-th element of vector

I want to get the i-th element of the void*. I understand that it is void type and I have to give it a certain data type. The idea behind this is that it should

Multiple problems with Sobel algorithm in c

I'm trying to build an edge detection program using the code below. I have faced a variety of problems though, that I don't know how to solve. #include <stdl

C programming issues, GTK assertion problem

I am posting this question because I have a problem with my beginner programming project. I am new in the use of gtk and I am blocked by a problem that I wish t

Can using volatile affect the behavior of simple property checking system?

I'm maintaining a project where someone has suggested that we make some variables volatile. I'm trying to understand if it's needed at all (or could be needed).

Quick sort in function

Task: using the function of generating an array to a file, the function of reading an this array, and the quick sort function, sort the read array. I wrote all

Length of array in function argument

This is well known code to compute array length in C: sizeof(array)/sizeof(type) But I can't seem to find out the length of the array passed as an argument t

Which C/C++ data type should I use for PHI(N) calculator?

I found a source code online for calculating PHI. I made some small adjustments to the variable types, such as using an unsigned long int, however I am limited

Trying to get the length of digits in c

I'm trying to understand why I am getting this error message. error: data argument not used by format string [-Werror,-Wformat-extra-args] printf("Enter car

Bubble sort on string array not doing anything in C with strcmp

I am trying to sort a string array in C (char**), the string array is an array of all the names of files in a directory. Here are all the parts of the code, I e

Missing separator in generated Makefile

I'm trying to compile this decade-old project: https://github.com/komar007/freecg The makefile generates Makefile.dep which seems incorrectly formatted. How sho

Purpose of bitwise operation in this example

In the function outb(0x3D5, (uint8_t) (pos & 0xFF));, I am having trouble understanding the purpose of the bitwise operation. pos is a uint16_t variable. Wh

C pointer to a pointer confusion

I have the following code. I tried to change the value of y by using a pointer to a pointer (i.e. trying to do a de-referencing twice from the pointer that poin

How to get the total?

Good day, I am practicing about Arithmetic and started to experiment a bit and got confused. How can I total the liter, refueled, and tendered? #include <std

How do I search most common words in very big file (over 1 Gb) wit using 1 Kb or less memory?

I have very big text file, with dozens of millions of words, one word per line. I need to find top 10 most common words in that file. There is some restrictions