Most voted "c" questions
C is a general-purpose computer programming language used for operating systems, games, and other high-performance jobs and is clearly distinct from C++. It was developed in 1972 by Dennis Ritchie for use with the UNIX operating system.
Learn more…4,811 questions
Sort by count of
-
1
votes1
answer48
viewsHow does access to strings in an array work?
Create a program that receives the date in numeral and then return it in full. I tried to do a few times, but I ended up merging my code with one I found from a forum and came out like this:…
-
1
votes1
answer40
viewsFast even random float within range
I did the following lcg (linear congruency generator) to draw unsigned int from 0x00000000 to 0xFFFFFFFF uniformly. Just for testing, I used the seed equal to zero and raffling the first five…
-
1
votes1
answer38
viewsI must meet the condition that if 0 is my first value, I must read another instead
The program must enter notes between 2 and 50 reais (2, 5, 10, 20, 50) and calculate the change value in these informed notes to 100 reais. If the first value is 0 I must read again another value…
casked 3 years, 11 months ago Vitória Rocha 31 -
1
votes0
answers29
viewsHow do you count the stock of monetary values
Hello, I’m trying to perform a program in which, you have to ask the user to enter a monetary value( random ) and let be displayed on the screen the amount of banknotes and coins of each type…
casked 3 years, 11 months ago Alexandre lopez 21 -
1
votes0
answers29
viewsCode returning "-Nan"
I made a code that performs 2 functions: calculates the average wage of an enterprise calculates the salary difference of each employee for the average wage When executed, an error occurs in the…
-
1
votes0
answers116
viewsString chained list within a struct
Hello. I’m doing a job where I need to store words in a list that must be inside a tree struct. I don’t know why the code stops inserting in the list shortly after moving to the next key/line. The…
-
1
votes0
answers321
viewsprogram in C to calculate the average , average and quantity of odd numbers
The point is this :Make a C program that reads from the user an integer vector with n positions in the range [5, 200]. Repeat the value of n until a valid value is entered by user. After reading the…
casked 3 years, 11 months ago Daniel Silva 19 -
1
votes1
answer20
viewshow to do to search the right code? because when I register a code, at the time of the search I type any value and the product I registered
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<locale.h> int main() { setlocale(LC_ALL, "Portuguese"); …
casked 3 years, 10 months ago willian lay 13 -
1
votes1
answer49
viewshow do I use the for correctly?
I’m doing an EP activity and he asked me for it in the image, but I got stuck in the sequence part, because, like the sequence is the top numbers is a sequence growing from 1 to infinity, and…
-
1
votes1
answer183
viewsCreating a Reverse Polish Rotation Calculator in C
need to do for an exercise an RPN calculator only for cases (+ - / * ), through batteries, it is necessary that the input is of type ABC+*, that the program understands this, the user of the values…
-
1
votes1
answer44
viewsProblem rendering multiple objects in Opengl Legacy (GLFW)
I am trying to render a circle and a rectangle, and both will have independent motion (Remake of Pong), but the problem is that the glTranslatef() of one is influencing the other, if one goes to the…
-
1
votes1
answer41
viewsLoop in a file being read in C
Well, I’m trying to read from a file, and create a loop so I can go through all the characters until I find '<' character. After finding this character, the program must read and save the handle…
-
1
votes2
answers35
viewserror when searching client
i made this program my problem is being in researching the client so I research it does not give me the result and terminates the program, I would like to know what I do to remedy the problem…
casked 3 years, 10 months ago Hugo LELIS 15 -
1
votes1
answer50
viewschar returns invalid typed number as option
opa good afternoon, I am developing a menu in which the option typed is a char, the same returns the default correctly after typing a letter, however, my switch has 7 case options ('1',…
-
1
votes1
answer32
viewsHow to properly traverse a matrix allocated in C?
Whenever I walk through my char matrix (char**) it changes all positions with the value of the last node, example; char** string = AlocaMatriz(10,10); //retorna uma matriz char** 10x10 allocada char…
-
1
votes3
answers68
viewsPassage by reference in C
My IDE is giving error in line: float CalculaHora(horas,minutos,segundos,&conversao); It indicates that you need a parenthesis before the operator &: #include <stdio.h> int main() {…
-
1
votes2
answers97
viewsMatch pointers in C
In this code I picked up because I was unable to think about the exercise, in line 3 of the code the program asks for the min scanf, where min is a pointer, and min receives a scanf value, but the…
-
1
votes0
answers62
viewsDifference between string size in Standard C and C++
I compiled the following code in C Standard and C++: #include <stdio.h> #include <string.h> char string[5] = "hello"; int main(void) { printf("string tem %lu bytes\n", sizeof(string));…
-
1
votes1
answer30
viewsIncorrect exit in practice
The data output from this exercise is not correct. I don’t know what I did wrong, if you can help me thank you very much Create a program that reads 10 integers and stores them in a vector. After…
-
1
votes0
answers66
viewsActivity Lists in C
I received the following activity in the topic of Lists in physical contiguity: "Complete the attributes of the contact list structure in the file list_contacts.h. Create a contact list file. c and…
-
1
votes0
answers25
viewsCode::Blocks does not print the output of a basic code
Hey, guys, what’s up? I am starting to learn C language and installed it manually in my Ubuntu 20.04 OS gcc 9.3.0. I installed codeblocks 20.3: Starting Code::Blocks Release 20.03 rev 11997…
casked 3 years, 9 months ago Caçador de Bolsominions 11 -
1
votes0
answers45
viewsLANGUAGE C-The determination of the monthly interest rate by determining the positive real root of the function
Hello, I need help with a language activity c. The program needs to read the amount that would originally be paid in a certain amount, the number of installments in which it was paid, and the amount…
casked 3 years, 9 months ago Julia Alves Guirado 19 -
1
votes1
answer128
viewsConvert lower case letter to upper case without using "toupper()"
I am working on a function to turn in capital letters, but my retouching is strange. In the end is giving the result below: Word input data: lucas Program is returning: LUCASÓÓÓÓÓÉð #include…
-
1
votes0
answers19
viewsHow to solve a C-segment failure with vectors?
Look! I don’t know what’s going wrong. When I compile my code in the codeblock, it’s all right. However when I sent the code to the evaluation in the run codes, they returned that besides taking too…
-
1
votes0
answers58
viewsDouble recursion in function of Ackermann
My teacher asked to make a program using double recursion to generate values of the Ackermann function, in which it is defined for integer and non-negative values m and n as this example: I made…
casked 3 years, 7 months ago Dennis Ricci 77 -
1
votes3
answers59
viewsValue of a "for" returned infinitely
Contextualizing: I have an exercise that suggests creating a program to read student grades and show grades equal or higher than average. Thus, the following code was written: #include…
-
1
votes0
answers25
viewsRelate String matrix to a Float vector in C
I need the program to receive 20 names typed by the user, store in a Char Matrix, and right after receive the 20 salary of the users and store in a Float vector. I was able to do even the part where…
-
1
votes1
answer44
viewsC : "fseek. c: No such file or directory" doing a Unix Tac
Guys I’m trying to do a programming challenge this one. It is not a very difficult challenge but my script does not have the expected behavior, in small files works but in larger files like 1GB I…
casked 3 years, 6 months ago PedroExpedito 29 -
1
votes1
answer53
viewsRead txt file names in C
So basically the code needs to read the names of a txt file (AFTER I WILL MANIPULATE THEM) until it has the word 'end. In that part of the code where it reads the lines, it just stores the 1 string…
-
1
votes1
answer36
viewsPthread_join not working as it should to popular a C array
I have the following code: #include <stdio.h> #include <pthread.h> #include <semaphore.h> #include <locale.h> #include <time.h> //declaração das variáveis globais float…
-
1
votes1
answer33
viewsError reading a file and saving it in dynamically allocated space in c
I want to create a program that: Opens the file teste I figured out the size of this file Allocate enough memory space for file + 1 (\0) Read the file contents using the function fread and saved in…
-
1
votes2
answers64
viewsbishop’s move on chess
I set up this code but as we know the bishop moves on the diagonals, but in my code he is moving straight... the "x" represents the houses that the bishop can pass. Can you tell me how to put the…
-
1
votes1
answer106
viewsDoubt about looping loops in C
I’m trying to solve this question: 3. The user enters two numbers x and y (with x < y): (b) The program returns the sum of the perfect numbers of the range [x, y]. However, he returns the number…
-
1
votes1
answer37
viewsfopen returning NULL
Good evening, I’m having a problem in fopen function within a subroutine. This returning NULL. I could not identify the error because I am still beginner, if someone can help me. Note: I declared…
-
1
votes1
answer38
viewsHow to pass a list of pointers that references functions as a parameter
I have a list of pointers that refer to functions in my code and I need to pass this list as a parameter to a function that prints the cases: double f00(double x){ ... return x; } double f01(double…
-
1
votes1
answer58
viewsReturning Multiple Values
The following code tells us to place a sequence of numbers in the following matrix and then assign a value to X and find out if the value of X is equal to some matrix value. But it is returning me…
-
0
votes2
answers631
viewsProgram "jumping" Variables
The program is skipping the variables without even putting the number I want to use on it. All I can do is put the first one in and then it jumps and it goes to zero. I don’t know if it’s program…
-
0
votes2
answers407
viewsRead Blocker in C
I am trying to make a server in C. After receiving the client’s connection the objective is to wait for information from the client in the socket, for this I use the following code. /*Read…
-
0
votes2
answers1172
viewsError from "expected Expression before ːint'"
I was following this example, but it was done on Windows, so it was used <conio.h>. When I try to run on Linux I get 2 errors: an *h=int(tempo);, that I don’t understand why, and the other in…
casked 10 years, 8 months ago Vitor Figueredo 209 -
0
votes1
answer95
viewsgcov tests code coverage during build or run?
I read about gcov for the first time in the Tor documentation, what it says: '-' before a line means that the compiler generated no code for that line. '######' means that the line was never…
casked 10 years, 8 months ago agentofuser 223 -
0
votes2
answers5760
viewsRead multiple integers in the same input in C
Basically, I must enter a number that represents the amount of integers to be entered. Then insert the integers themselves, separated by space, into the same input. Example: 5 1 2 3 4 5 I tried to…
-
0
votes1
answer215
viewsmysql connection error with c. Unknown type name 'SOCKET'
I have this code and is generating error. #include <stdio.h> #include <mysql.h> #include <windows.h> #include <sys\socket.h> void main(void) { //parâmetros para Conexão char…
-
0
votes1
answer71
viewsCounting a given day period with more vehicles
I’m doing a project where it’s based on creating a structure, a vector of a structure, filling that vector with data from a file and then performing some functions. One of the functions is to count…
casked 10 years, 6 months ago José Pedro Brito 1 -
0
votes2
answers171
viewsHow to insert an asterisk every 3 characters?
How do I type any value, whether text or number, and every 3 positions an asterisk be inserted? Example: type 123456789, by pressing enter appears: 123*456*789*…
-
0
votes1
answer297
viewsStack Frame - Example
I’m developing a program to simulate a Stack, however I’m having some difficulties in understanding how it works, can I correct this example? main(int y) { int j; f(j+1); } f(int x) { int i; return…
-
0
votes2
answers2590
viewsStruct member access error passed by reference
I have the code below that has a function to define the salary = 4000, but it returns me the following error: [Error] request for Member 'salario' in Something not a Structure or Union The error…
-
0
votes2
answers371
viewsEliminating extra characters using scanf
Hello, my friends! I am creating a program that reads data separated by semicolons, the Czech and returns a list with possible errors. (example: the user enters CNPJ, social reason, UF as follows:…
-
0
votes3
answers2578
viewsHow to read another program’s variable?
Guys, I am learning Programming and I would like to know: how do I read the value of a variable of another program (theoretically this would be without "awareness" of the program read, I do not know…
-
0
votes1
answer63
viewsReading values from a C file
I have a file containing the following values: 10 20 30 40 50 60 For each line, the values must be stored in a vector. How do I get such values from the file, knowing that there is no exact amount…
-
0
votes1
answer330
viewsProblems with programming logic
basic C study and I’m having problems with logic, I’m doing some exercises that require calculations like factoring decomposition and even problems like "A is twice the age of B when A was the age…
casked 10 years, 5 months ago Leonardo V. De Gasperin 713