c

Static functions in C

I can't fully understand the meaning of the static functions. I understand that it restricts visibility, but it is already in ... m there, without explicit intentions (declare in *.h or declare in extern) will fail. Why then static? To be safe from this?

All combinations of n digits in ascending order

You need to create a function that displays all the different combinations of n digits in ascending order, or you can say tha ... k++; } j++; } i++; } } int main() { ft_print_comb(); return 0; }

Find the most frequently occurring element in an array faster than in O (n2)

The task is as follows: Find the most frequently occurring element in the array faster than in O(n2). If there are severa ... a, correctArray)) { printf("Error"); return 1; } printDifferentiationOfNumber(); return 0; }

Can I write directly to syslog?

Is it possible to write directly to /dev/log as in /dev/stdout? For example so: echo test > /dev/log I get an error: Bash: log: There is no such device or address. If it's even possible, what am I doing wrong?

Why does this work in gcc?

A static array with a size not known at the time of compilation. char buf[atoi(argv[2])]; And where can I read about it?

Error "error: assignment to expression with array type"

I want to draw a field for the game. I created a 2D masiv, and I wanted to transfer some data to its cells. As a result, it r ... ain.c:23:18: error: assignment to expression with array type field[i] = "# #"; ^

Converting char to int

How can I cast char to int to perform arithmetic operations on a number that is stored as a character / array of characters? int a = 1; float b = 2; char c = "3"; //char c может быть равно 43 или любому другому числу int d = a+b+c;

Create an array of structures with students in C

When creating a function that adds students to an array of structures, it highlights them in red. Here is the entire code # ... student res_st; scrcpy_s(res_st, 50, name); } Why can't I create the addStudent function? Thank you in advance.

How to create a.iso image from multiple.bin files?

Attention! Possible aggression from the stupidity of the question, please treat with understanding! I decided to make hellowo ... yntax. I apologize if I said something really stupid, it's just that there is too little information on this topic in Google.

Pointer notation in C++

Hello. Are there any significant differences between such pointer definitions: int* a; int *b; I would also like to find ou ... void this: int var = 123; int *ptrvar = &var; int **ptr_ptrvar = &ptrvar; int ***ptr_ptr_ptrvar = &ptr_ptrvar;

Binary Number Calculator

In general, you need to make a calculator of binary real numbers in c, I tried using a crutch: I converted it to decimal SS, ... so you need a hint. How and which ones should bitwise operations be used to add, subtract, and multiply binary real numbers?

divide a string into c words

Words are separated by one or more spaces and punctuation marks(",", ";", ":", "-", ".", "!", "?"). scanf, sscanf, or strtok are not allowed. How can this be done?

Character strings. C.

Hello! Please help me with one task in C. I enter a sentence from the keyboard. It is necessary to print each word separately, but starting from the end of the sentence. that is, from the back to the front. How to implement it?

Has anyone met sizeof (char)!= 1 in their practice?

Interested in one of the answers to a recent question on C++ (C) Calculating the length of a string without using strlen() ... we are talking about C (C++), not Java, etc. At the same time, has anyone ever dealt with a byte not consisting of 8 bits ?

Accuracy in calculation

I solve Olympiad problems of various kinds, when I worked in Pascal, I never thought about the work of the operator " = " or ... freopen("output.txt", "w", stdout); scanf("%lf\n", &a); scanf("%d", &n); solve(); return 0; }

Why does the "scanf" function not work in C?

/*The program requires the user to enter data, but this data is not perceived by scanf, either minimum values or zeros are se ... ромб, введите координаты заново\n"); system("pause"); return 0; } } //(here is the program itself)

C++: converting a simple fraction to a decimal

Please tell me with the algorithm: I have a simple fraction that is stored as a pair of integers using fraction_t = std::pa ... iplier *= 5; } if (value == 1){// десятичная дробь} Is there any the ability to perform such a task in a more optimal way?

Why do I need these macros in C in the inttypes.h header file

What these macros SCNxN and PRIxN are for. For example: #include <inttypes.h> // В функции считывания данных uint32_t code_point; fscanf(in, "%" SCNx32, &code_point); printf("%" PRIx32, code_point);

How the |= and &=operations work~

Help me figure out what this line does: PORTX |= (1 << 2); PORTX &= ~(1 << 2); Well, I can't understand at all what it is |= or &=~... You can use an example to explain these lines....

Correct translation from pluses to C

#include <iostream> using namespace std; void swap(int *a, int i, int j) { int s = a[i]; a[i] = a[j]; a[j] = s; ... loop, the question is: "How to fix it?" Here is the result of the program output on the pros: And this is what I will do.: