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
-
-3
votes2
answers63
viewsInfinity C loop array
In this example below, how do I print on the screen all values assigned to n during the loop, after its completion? #include <stdio.h> #include <conio.h> int main (void) { int n; for…
-
-3
votes1
answer56
viewsError in struct C language
Guys, I’m making a code that the first moment should store the register of patients of a clinic, for this I’m using struct and a variable of this struct to store data for 5 patients. The problem is…
-
-3
votes1
answer44
viewsI’m having a problem with my code I can’t bring the data from one function to another!
I’m having a problem with my code I can’t bring the data from one function to another!! in the case of Function sum I cannot print it in function print. Can someone help me 1 - Insert into a vector…
-
-3
votes1
answer27
views"Segmentation fault(core dumped)" error in C language if-Else program
Greetings! I’m a beginner in programming and found this problem in a code: Segmentation fault (core dumped), after entering the first variable. That is the code: #include <stdio.h> #include…
-
-3
votes0
answers41
viewsTest Template Check - Language C
I have a question I need: Read the proof feedback; Read the students' names; Read each student’s answers. At the end of the program I must print: the name of the student + how many questions he got…
-
-3
votes2
answers43
viewsProgram stops reading before the for and "hangs" during the run (C)
I am performing this exercise in C which is a challenge for college. No note is worth. The purpose is to use the for and find pi. The statement is in the body. For some reason, when I give run in…
-
-4
votes1
answer283
viewsSublime text with Exit code 1. How to resolve
I’m with this ERROR when trying to compile any code in C in my PC: [Decode error - output not utf-8] [Finished in 0.2s with exit code 1] I installed the MinGW and the modules gcc(C++ e C), but still…
-
-4
votes2
answers98
viewshow do I save the data entry permanently
I want to create a C program in which the user enters his name and this is saved permanently, but the user name is only saved until the program closes. How do I make the program to leave user data…
-
-4
votes2
answers76
viewsStrict Aliasing do c
Guys I would like someone to explain me this such Strict Aliasing , and with cast examples , I saw in a book more did not understand right.
-
-4
votes1
answer71
viewsComplicated program
I’ve been trying for a while to make a program that does the following: Ask a user to enter a number amount and then to enter the number amount he wants to have in the combination and then the…
-
-4
votes1
answer74
viewsDoubts in the resolution of an exercise using while or for
Good evening my dear, My doubt relates to repetition (while and for). In one exercise I want to print the numbers from one to 10. However I want to group them 2 to 2, or 3 to 3 to follow that logic:…
casked 8 years, 6 months ago F.Henrique 11 -
-4
votes1
answer740
viewsid returned 1 Exit status in C
My code keeps giving this error and I don’t know what’s wrong: #include<stdio.h> // printf, scanf // Função principal int main(void) { // início do programa principal // Declaração das…
-
-4
votes1
answer419
viewsVariable declaration problem to compile in Code::Blocks
#include <stdio.h> #include <locale.h> #include <string.h> int main () { setlocale (LC_ALL,"Portuguese"); int num,escolha; char nome[20]; printf ("\nDigite seu nome: "); gets…
-
-4
votes1
answer1001
viewsHow to convert a String Char by storing it in an Integer array in C?
How to convert a String Char and add to an Integer array?
casked 7 years, 1 month ago Nilzon Martins 189 -
-4
votes1
answer92
viewsHow to make an algorithm that receives the name of a day of the week and shows the subject that the student has on the day
the part of logic I know is simple but I believe I’m wrong in the syntax, in my view it would be if day == second printf("second class") but so not sure, someone could help me, I’m trying to do in…
casked 7 years, 1 month ago Lucas Sylvestre 1 -
-4
votes1
answer295
viewsVariable type float does not receive valuation
Follows an excerpt from the code: #include <stdio.h> #include <stdlib.h> #define MVAIN 0.8592; #define MVAOUT 1.0282; #define ICMS 0.29; float ProdValue = 0, MVA = 0, ResultValue1 = 0,…
-
-4
votes2
answers556
viewsCreate a function that returns random number in C
Good afternoon, I have a project in language c to deliver, and it’s almost all ready, but the teacher said q we have to use a function that returns random number, but the random function I have to…
-
-4
votes2
answers451
viewsHow to give 'value' to a char variable?
I have a question about how I can give value to the char variable without the scanf command, for example: I have a variable called name and I want to say that it is worth maria. how do I do that?…
-
-4
votes2
answers270
viewsLanguage C - Structure jumps directly to ELSE ignoring IF parameters
#include<stdio.h> int main(){ //Escolhe entre nome do personagem e classe int p,c; printf("RPG teste\n"); printf("Digite um nome para o seu(a)…
-
-4
votes2
answers96
viewsWhat is the mistake in logic?
Given the values of x real and n natural positive, calculate: #include <stdio.h> int main(){ float x = 0.0; int n = 0; int soma = 0; int fat = 1; printf("Digite um valor:"); scanf("%f",…
-
-4
votes2
answers132
viewsI need the replay to stop when I type "F"
#include<stdio.h> main() { int O,i; float F,VI=0,VF=0; printf("Valor Inicial:"); scanf("%f",&VI); printf("Valor Final:"); scanf("%f",&VF); while (VI!=F) { if(VI<=VF) O=1; else O=-1;…
-
-4
votes1
answer149
viewsCalculate the Timetable in C. Financial year
I started programming recently and I’m having trouble solving this exercise: Write a program that reads the departure time (hours and minutes) of a flight, the travel time and the difference in…
-
-4
votes1
answer47
viewsDanger signal on a var in C
The program and the recursiveness are correct, but even so, a danger signal occurs. #include <stdio.h> void ant_suc (int num){ int ant = num - 1; int suc = num + 1; return printf("O numero…
casked 3 years, 8 months ago Socorro de Jesus 1 -
-4
votes1
answer51
viewsHow can I get this code to display the first 100 even numbers not multiples of 10?
#include <stdio.h> #include <conio.h> int main () { int count; for (count=0;count<200;count=count+2) printf ("%d \t ",count); if (count%10==0) { count++; } getch(); return(0); }…
-
-4
votes1
answer104
viewsI’m having doubts in this puzzle, I can’t find the error in the program
ola I’m doubtful in this puzzle I can’t find the error in the program. int main(){ char n_a[500] char cit[500]; float codigo,n1,n2,n_l; printf("-------------------------------------------------\n");…
casked 6 years, 8 months ago Miguel Garcia Silvestre 13 -
-4
votes1
answer48
viewsHow to convert DDMMAYY to DD/MM/YYYY in C
#include <stdio.h> // tetando ex 01 int main(){ int dia,mes,ano, data; printf("Digite a data em DDMMAAA: "); scanf("%d", &data ); dia= data/1000000; printf("%d", dia); } I can’t develop…
casked 3 years, 4 months ago Megane-12bit 1 -
-4
votes1
answer50
viewsWhy don’t my strings concatenate correctly?
I want to display information in the following format: last surname/first name. But it keeps skipping a line in the concatenation. At least, that’s what I think is happening... #include…
casked 6 years, 2 months ago Lucas Correia 53 -
-4
votes1
answer80
viewsWhat’s wrong with this excerpt?? file reading
What’s wrong with this excerpt?? I need to open a file to read and store in a struct, but if I put the condition in while feof!= 0, when I run it does not work. (this is a function that is being…
-
-4
votes1
answer80
viewsGender neutralizer in C!
I am a beginner in the programming area and took some basic exercises to train my lóg. de Prog. in C. And one of these questions was to develop a program that would neutralize the gender of the…
-
-4
votes1
answer658
views -
-4
votes1
answer47
viewsIt’s not compiling! And I can’t find an answer!
Do not want to compile... #include <stdio.h> #include<stdlib.h> int main() { system("title-Ajust System:Windows 7");//declarada-Title printf("SYSTEM 00.1-BETA\n\n");//-Name…
casked 5 years, 5 months ago C0DIFICAD0 1 -
-4
votes3
answers92
viewsBeginner Language Error C Code Blocks
#include <stdio.h> #include <stdlib.h> int main(); {int dinheiro = 200}; int r$100, r$50, r$20, r$10, r$5, r$2, r$1; int inter; while(dinheiro > 0) { if (dinheiro >= 100) { r$100 =…
casked 5 years, 4 months ago Matheus Accetta 1 -
-4
votes1
answer55
viewsWhile counting zero more
#include <stdio.h> #include <stdlib.h> int zeros(signed char *V, int n){ int i = 0; while(!V[i] && i < n){ // Ou acabou o vetor caso seja inteiro zero i++; } return i; } int…
casked 4 years, 2 months ago Douglas Oliveira 1 -
-4
votes2
answers149
viewsString-populated chained list(Linked list)
Hello, I’m trying to create a list that is populated with strings but when I try to print it nothing appears. I appreciate any help available. #include <stdio.h> #include <stdlib.h>…
-
-4
votes1
answer54
viewsDoubt how to reverse values in a statistic list in C
Hi, I’m having second thoughts about a university paper on how to reverse a sequence of numbers into a static list in C. The specific part I’m doubting is : **int SList_reverse(SList* lista, int…
-
-4
votes1
answer48
viewsI can’t use strcmp in C
I need to show a student’s chart using the license plate, as I do? #include <stdio.h> #include <stdlib.h> #include <string.h> main() { struct ficha { char matricula[9], inf[9];…
-
-4
votes2
answers355
viewsDoubt in LANGUAGE C
You guys, good night. I am learning C in college and we have been asked an exercise to read the salary of an employee.(until I ask for forgiveness because close to the most experienced, my code must…
casked 3 years, 5 months ago Mateus Malvezzi 1 -
-4
votes1
answer37
viewsWrite number from 0 to 10000 in c++ language
I need help to write numbers in full from 0 to 10000. I could only write up to 1500, as you can see below: #include <stdio. h> int main () { float a; printf ("Digite um numero de 1 a…
-
-4
votes1
answer44
viewsCalculator in C does not return decimal numbers, when dividing 7/2 it returns me 3. And how do I get the code back to the choice menu?
I have tried to use some other topics here but unfortunately they have not solved my problem. The most I could was showing 3.00 using float, but I don’t think I used it correctly. Whenever I divide…
casked 3 years, 4 months ago David William 1 -
-4
votes1
answer30
viewsDoubt on how to read a line in C (sscanf)
My goal is to read 2 user lines, where each line has a number n >= 0 of integers, separated by space. The problem is that, when n = 0 (which is the case of line 2 of the code below), the program…
-
-4
votes0
answers21
viewsMy while, is showing error, calculate and show on the screen the sum of the n odd power of degree 2 of 10 integer numbers any
#include <stdio.h> #include <stdlib.h> int main() { int numero,cont, som1, somtotal; int i; som1 = 1; somtotal = 1; char cod; while(cod!='F'){ for(cont = 1; cont < numero;cont = cont…
-
-4
votes1
answer32
viewsCreate a program that reads a number between 2 and 20 and generate a screen with the configuration shown below:
the program must display the following result: Type a random number between 2 and 20: 7 Exit from the program: 1234567 x123456 xx12345 xxx1235 xxxx123 xxxxx12 xxxxxx1 (NOTE: the value typed by the…
-
-5
votes2
answers266
viewsHelp to write code
How do I use Dev-c++ with this code. How to translate it to C? I started recently with programming, I’m a little tied up to understand some things. Programa CalculoMedia Var N1, N2, MEDIA: Real…
casked 10 years, 8 months ago matheus ferreira 357 -
-5
votes1
answer33086
viewsid returned 1 Exit status C code, help
my code is giving error id returned 1 and I have no idea why giving this error I did everything right, someone could help me? #include <stdio.h> #include <stdlib.h> int main () { float…
casked 10 years, 7 months ago matheus ferreira 357 -
-5
votes1
answer94
viewsCast struct em struct
Guys I’m using sockets in windows and when I get to connect I have the sequinte parameter: (struct sockaddr *)&server(which is my socket) how this cast works?
casked 9 years, 3 months ago alexsander 11 -
-5
votes1
answer199
viewsVectors, pointers and memory storage
I need to solve an exercise where I need to use pointers, vectors and memory storage: Create a vector with n elements, and each vector position will match a pointer to a value of type float. Make…
-
-5
votes1
answer54
viewsSelection structure, use of the for
I need to select animals older than (60 months), and return their consumption and monthly production, as I tried to idealize in the equations. However, it does not return any number correctly.…
-
-5
votes3
answers59
viewsHow to create a function that divides two numbers into C?
How to create a function that divides two numbers into C?
-
-5
votes1
answer47
viewsIs there any more beautiful way for me to change the numbers?
This is my code: #include <stdio.h> #include <stdlib.h> #include <locale.h> #include <unistd.h> #define tam 20 int main (void){ setlocale(LC_CTYPE, ""); int num[tam]; int…
-
-5
votes1
answer835
viewsFunction that converts string to lowercase and compares
struct registro{ /*Estrutura para guardar os dados do usuário*/ char usuario[50]; }atual[1000], *ptr; main() { int v = 0; verific = 0; //posicao e variavel para comp. de string volta_usuario:…