c

Problem with input to C while waiting for scanf at the same time

The problem is that when you first press ctrl+c, then enter a word with a length of 5 characters, then in main, 5 characters ... ) { signal(SIGINT, sigHandlr); // Ненадежные сигналы char asd[10]; scanf("%s", asd); printf("%s\n", asd); }

Quick sort in descending order to C [closed]

Closed. This question should be clarified or supplemented with details . Answers to it are not accepted at the moment. ... ;= high) return; middle = split(a, low, high); QuickSort(a, low, middle - 1); QuickSort(a, middle + 1, high); }

The UTF-8 encoded file contains invalid characters

There is a function for writing a string to a file. There is an offset parameter that determines how many positions from the ... T); } ssize_t written_bytes; if ((written_bytes = write (fd, buffer2, strlen)) < 0) { buffer2[written_bytes] = 0; }

Dynamic array of the char type

I'm writing a dictionary and I'm completely confused in the code. I'm testing a function that reads a text file with a matrix ... u explain why the array itself doesn't want to be asked? The compiler (MSVS) writes that char * cannot be (char(counter)[3]).

Lost 1 bit in long double

Following the question about the bit representation of real numbers and my answer to it. I want to programmatically determin ... 79 bits. Instead of 80. Where's the other bit? long double is a 10-byte numbers, but sizeof returned 16. How can I get 10?

Implementation of a class of large numbers with long arithmetic

I am writing a class for large numbers up to 2^512 in length. I use the unsigned __int64 array. The addition of numbers is in ... c = t % LLONG_MAX; res.number[i] = c; } res.number[7] = t; return res; } };

Passing a two-dimensional array as an argument to a function

I can't figure out how to pass a two-dimensional array to a function, and output it to the screen with this function. And wha ... ={{10,9,98,65}, {8,-9,-4,6}, {15,6,78,-8}}; printmas(danmassiv); }

Sorting a singly linked list by inserts

I implement sorting the list by inserts. I spied an example of such sorting here and changed it to fit my list. Here is the s ... using typedef and the name The structures are at the end, but I haven't read K&R to the point where it's being told yet.

C. Declaring a dynamic two-dimensional array

I am studying the declaration of two-dimensional dynamic arrays in C. I assumed that dynamic arrays here can only be declared ... I tried elementary: int m, n; scanf("%d %d", &m, &n); int a[m][n]; And it worked. Is this normal? Can I use this?

A singly linked list. C

I tried to implement a singly linked list, the function of adding an item to the end of the list, to any place in the list. M ... lement", i + 1); scanf_s("%d", &data); add(i,&data); } system("pause"); return 0; }

What is the point of backtracking?

What does recursion have to do with it , and what is its role in backtracking ? Does it force the algorithm to return to the previous steps ? And what is backtracking ?

What is the meaning of the char * const* type in C?

char* - a pointer to a variable of type char. char* const - constant pointer. const char* - a pointer to a constant variab ... type. Same thing with const char* const*. What is the meaning?* after const coupled with char*? How do I describe this type?

Error in the scanf function in c

Hello. When trying to compile the project, the following error occurs: Error C4996 'scanf': This function or variable ma ... P. S: when using scanf_s, compilation is successful, why doesn't it work with scanf? Visual studio development environment

How do I count the number of words in a string?

Given a natural number n and a sequence of characters S1...Sn. Groups of characters separated by one or more spaces will be called words. Count the number of words in a given line.

Float type range

Reading Ritchie and Kernighan. C. It says that float is a 32-bit type, but then it says that its range is 10-38 – 10+38. Why ... , how bit depth affects operation, etc. All I have in mind is Tannenbaum, the architecture of the computer. Or won't that do?

How to select the integer part of a number in C and how to round the number to the nearest integer?

As in C, you can select the integer part of a number. And how can you round a number to the nearest integer?

Why do I need typedef?

What is the difference between typedef struct LINE { .... }; And struct LINE { ... };

How to allocate memory for a large two-dimensional array in C?

I'm working with a large two-dimensional array. In the case where it is 30 x 200 in size, everything counts. At large volumes ... (double *)malloc(n_A * sizeof(double)); memset(B[i], 0, n_A * sizeof(double)); } free(B); return 0; }

Write your own pseudorandom number generator

You need to write your own generator, because there is no way to add a library with a built-in one. Can you please suggest a ... little more complicated there. Has anyone ever had the experience of writing a primitive RNG without any built-in functions?

C. Conditional operators in the macro definition of the preprocessor. Is it possible?

You need to exclude the debug printf() from the program by applying the preprocessor constant. Frame each call printf() #if ... #define printf(x,y) (if DEBUG == 1 printf(x,y) endif) #if inside macro definitions are forbidden. Is there an alternative?