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
-
0
votes2
answers168
viewscalculation of media in programming c
Hello I’m putting together a code for an activity of my course but the media that needs to appear at the end if you enter a negative number only appears zero, I’m a beginner in programming so I’m…
-
0
votes1
answer67
viewsProgram does not execute the While command after reading in the scanf
I was trying to make a program to calculate the mmc of two integer values, but I can’t even test my code, since no tested compiler has ever run , someone knows what might be?Follows the code:…
-
0
votes1
answer152
viewsProblem in returning Struct in C
I’m making a simple program in C that takes name, enrollment and two student grades but when returning the value typed struct in the function Show it does not return anything #include…
-
0
votes1
answer76
viewsSum letters and show value
People I really don’t know where to start,how can I solve this problem? If someone can give me tips on how to do,. MAKE a complete program to treat the problem described below: Three friends decided…
casked 5 years, 11 months ago Bruna Ferreira 1 -
0
votes0
answers62
viewsBinary save
People, I have a structure of 10 fixed positions. Each of them has a vector whose size has been dynamically allocated. I am trying to save in binary file the information and then perform the reading…
-
0
votes1
answer182
viewsPrint and receive Vector Struct values in a function
I looked in several places about it but I couldn’t find any correct answer, I wanted to know the correct method of filling a structure vector passed by reference to one function and then printing in…
-
0
votes1
answer572
viewsChained row in C
I need to put "10 car plates" on a chained list, only I’m having trouble putting something like char on that pointer, I even used the function strcpy but is giving bugs... strcpy(f->no,…
casked 5 years, 11 months ago Wendel.19_xx 1 -
0
votes3
answers335
viewsError when De-locating Matrix - double free or corruption C
Hello, I’m running a program to rotate a matrix, which after allocating executes the rotation function, and then displaces the data. The problem is when I try to dislocate, it’s returning me double…
-
0
votes1
answer98
viewsWhile finds no match, C language
I have the following code in C: #include <stdio.h> #include <stdlib.h> #include <locale.h> struct crPlayList{ char music[120], singer[120]; float mustime; struct crPlayList *next;…
-
0
votes2
answers697
viewsError lvalue required as left operand of assignment
Someone help me, how can I resolve this error:[Error] lvalue required as left operand of assignment #include <stdio.h> #include <stdlib.h> #include <locale.h> main () {…
-
0
votes2
answers249
viewsProblems with CRUD in C (DELETE method)
In the delete function, the user will inform an AR that he wants to delete, when the AR exists in the memory he deletes, that part of the code works... The problem is when it does not find in memory…
-
0
votes2
answers518
viewsChained list - [Error] Storage size of 'mylist' isn’t known
I’m having trouble developing a chain list, so please help me. Every time I try to compile error appears on line 7 [Error] Storage size of 'mylist' isn’t known I’ve already changed the place…
casked 5 years, 11 months ago Ramon Dos Santos 5 -
0
votes1
answer152
viewsHelps in C dynamic allocation exercise
The exercise is as follows: Brazil has just bought a new territory where the newest Brazilian state will be built. Unlike the other states, it will have all its infrastructure planned and, for this,…
-
0
votes4
answers428
viewsReceive various values and print only the 3 largest ones in c
Hello, I have an activity to be done that consists of receiving values and only stop receiving them when typing -1, then the program should display the 3 highest values typed as if it were a ranking…
-
0
votes2
answers439
viewsWhile() read by line in file . CSV
Good morning, I have the following structures: typedef struct celCidade *apontadorCidade; typedef struct celEstado *apontadorEstado; typedef struct{ char nome[100]; int populacao; int beneficiarios;…
-
0
votes1
answer61
viewsProblem with reading file C language
Good evening guys. So I’m doing a two-step assembler, so I have to upload a file in the format. a and assemble a file in the format . mif, only when I make the first step to save the addresses of…
-
0
votes1
answer55
viewsError in data output
I want to print the output exactly as below, but the code is giving the output in each entry. Entrances rmtpuzcafhnyxdesivlkbwgjqo 3 roahp uhchch veras Exits veras potato wuvrl #include…
casked 5 years, 11 months ago Bruno Gomes 19 -
0
votes1
answer77
views -
0
votes1
answer95
viewsI need help solving this exercise (e.g.: 8 project Uler)!
The question asks that in a number of 1000 digits we find the largest product of 30 adjacent numbers (question link), I know I can do this just by playing a 1000-digit string and checking if 1 to 5…
-
0
votes1
answer427
viewsPthreads, Buffer Consumer Producer Problem in C
The Goal of the program is to give in the command line nt=number of tasks that will be created , an integer n, and nbloco, number of interactions that each thread can have to calculate the sum of…
-
0
votes1
answer154
viewsby pressing enter, cmd opens but closes even not completing all commands
#include<stdio.h> #include<stdlib.h> int main (void) { int valor1,valor2,soma,sub,mult,di; printf("Digite um numero inteiro: "); scanf("%d\n",valor1); printf("Digite outro numero…
casked 5 years, 11 months ago Julio César 1 -
0
votes1
answer32
views -
0
votes0
answers66
viewsIn C -> Multiple Struct Passages as Parameter
Good to all! I am studying about double chained lists, arose the need to pass one struct into another struct, into another. I already managed to make one, however, instead of using a book struct, I…
-
0
votes1
answer60
viewsProblems with averages
I need to insert 3 notes, average with 3 notes, then with the highest note and the second highest note , then with the highest note and the worst note. #include<stdio.h> int meio(int a, int b,…
casked 5 years, 11 months ago Pedro Sabença 1 -
0
votes0
answers43
viewsHelp with Text Editor and C Executable
I developed a C algorithm for order counting, when I compile inside the Text Editor (ATOM), it performs everything correctly. But when I go to the executable generated in the project folder, it…
-
0
votes1
answer91
viewsCreate a recursive function to accuse the occurrence of an element in a matrix
I have some problems creating a recursive function that accuses the occurrence of a requested element. So far, this is what I’ve been able to do (perhaps I’ve made some mistake with pointer…
-
0
votes2
answers820
viewsC program does not correctly read a . txt file with integer numbers
I’m with this C code where the goal is to read 25 whole numbers of a text file and store them in a 5 by 5 array. The problem is that when running on MS-DOS, the program prints only junk from memory.…
-
0
votes3
answers189
viewsFunction to print the number of characters in a two-dimensional string
By the enunciation of the exercise, I must use as the second argument char **strings, I believe that there is my confusion, in manipulating her to count the size of string. (I did other tests with…
-
0
votes2
answers72
viewsC program does not read values in txt file
Guys, I’m back again. I applied some changes that the members here suggested in another post, but the values are still not read correctly. Now gives up to integer values (before DOS printed negative…
-
0
votes3
answers82
viewsHow do I insert a menu?
To with a project, and the final part of it is inserting the menu of choice for user. I will leave the original code, because of several attempts, all were unsuccessful. Even includes the case,…
-
0
votes1
answer54
viewsError in the roots of Bhaskara
#include <stdlib.h> #include <stdio.h> #include <math.h> void func(double x1, double x2, double x3, double *delta, double *r1, double *r2); int main(){ FILE *file;…
casked 5 years, 10 months ago William Dias 11 -
0
votes3
answers64
viewswhen I put a small number in my algorithm it works, but if the number is large the program returns 0
when I put a small number in my algorithm it works, but if the number is large the program returns 0, I tried to put unsigned int, long, etc and it didn’t work... Here’s the code: #include…
-
0
votes0
answers37
viewsWhat is volatine in C
I’m reading this booklet (http://www.inf.ufpr.br/lesoliveira/download/c-completo-total.pdf) and came across the modifier volatile. I don’t quite understand how it works, so my question is: What it’s…
casked 5 years, 10 months ago Devprogramacao 119 -
0
votes1
answer38
viewsProblems with logic in a program
//EXERCICIO 103 //VERIFICAR SE UM NÚMERO É PRIMO #include<stdio.h> #include<locale.h> main(){ setlocale(LC_ALL,""); int n,k,cont,div; printf("Informe um número: "); scanf("%d",&n);…
-
0
votes2
answers115
viewsWhat is the performance gain when I log into my variable?
I’m still reading the Complete and Total C booklet, and it says that: [...] This means that operations on the Register variables could occur much faster than on the armezanadas variables in memory,…
casked 5 years, 10 months ago Devprogramacao 119 -
0
votes3
answers751
viewsCompress array by removing zeros [C]
Question: Make a program that reads a vector of 15 positions and compact, that is, eliminate zero positions. For this, all elements ahead of zero a rearward position shall be moved in the vector. My…
-
0
votes1
answer56
viewsHow do you reverse the digits of a vector and print them separately ? And can you differentiate 000 from 0 in C?
I have to do a program to reverse the digits of a number and print it between brackets []; To begin , the reading loop has to stop when the number typed is equal to 0, however if the value is a…
-
0
votes2
answers222
viewsproblem comparing strings in c language
I need to answer a question that asks to type two words, like this: is a canteen and there are 4 possible requests. Two options for food: lasagna and stroganoff; Two drink options: juice and soda. I…
casked 5 years, 10 months ago Letícia Gabriela Cena 37 -
0
votes3
answers108
viewsProblems with a C program
I’m having trouble developing a program that solves the problem below: Write a program that reads two integers M and N and calculate the average arithmetic of the prime numbers of the range [M, N].…
casked 5 years, 10 months ago Paulo Sérgio 13 -
0
votes1
answer41
viewsVector in struct does not work
Good night! I’m trying to store some variables in a struct with a .dat. My goal is to take each line of this file and store it in a vector position of the struct. The Qtd and the track are working,…
-
0
votes0
answers173
viewsError Segmentation fault(core dumped) in C
When trying to calculate which prime can make a division of rest 0 with the number 600851475143 I came across the error segementation fault(core dumped) (although I used the sieve of Eratosthenes…
-
0
votes1
answer43
viewsHow to dynamically allocate memory to a 2D array that stores the pixels of a bmp file in C?
I am trying to dynamically allocate a 2D array to store a bmp file with the following code: #include <stdio.h> #include <stdlib.h> int height, width; // variables for the image height…
-
0
votes0
answers26
viewsIncreasing the capacity of an int - C
When trying to calculate which prime can do a 0 rest split with the number 600851475143, I get the error Segmentation fault with the following script: int count_1 = 0, count_2 = 0, soma = 0, maior =…
-
0
votes2
answers74
viewsScanf does not close the read
I am trying to make a program where it receives a char matrix and at the end prints the new matrix. #include <stdio.h> int main(){ int l,c,i,j; scanf("%d %d",&l,&c); char…
-
0
votes1
answer69
viewsWhy isn’t my vector getting sorted?
I’m trying to create a code, where it orders a vector of integer for matter of size, where the rule is the same as bubbleSort: Compare Left to Right If the Left value is greater than the Right…
casked 5 years, 10 months ago user148754 -
0
votes1
answer274
viewsExpected Primary-Expression before"int" - C
I have the following error in my code: expected primary-expression before"int" #include<stdio.h> #include<stdlib.h> void imc(float massa_corporal[3], float peso[3], float altura[3], int…
casked 5 years, 10 months ago Gabriel Ferreira 25 -
0
votes1
answer84
viewsString comparison
Is there any way I can find a specific letter in the string to enter this if of the special or normal account?? /*As contas dos clientes de um banco podem ser divididas em contas “Comum” e…
-
0
votes3
answers51
viewsAverage age in a family - Core dump error
the code below is intended to read a Qtd amount of people in a family, receive the sum of ages and present the average at the end: #include <stdio.h> int main() { int qtd, idade, i; float…
-
0
votes2
answers86
viewsString problem in C, term exclusion in string, through string comparison
I wrote a code that excluded the similar term in both strings, but it does not print the result of the text by taking the second term, it only removes the first term from the first string. "Create a…
-
0
votes1
answer403
viewsPass data from one array to another
How can I pass some data from one vector to another? I’m doing an exercise and I need to take several data from several students at struct and place in a vector. Then I need to check if they were…