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
answers603
viewsWhile or Do While exercise using CHAR variable
Good evening guys! and the following.. I need to do this exercise here while in C: e) In a presidential election there are 2 candidates. Votes are informed through codes. For candidate 1 the code is…
casked 5 years ago Luciano Balestrin Correa 71 -
0
votes2
answers169
viewsRead multiple values and average
In this algorithm if I write 10, 10 and then -1 to shut down he calculates 9.5. No division gives exactly the result it should be, or is it my algorithm that is spelled wrong? That would be the…
casked 5 years ago Luciano Balestrin Correa 71 -
0
votes1
answer34
viewsSocket error in C recv(), send() // SERVER [CLOSED]
I am new in c and in the area of networks, went to create a code in c to put into practice the theory, however, after bindar and create the connect socket, any function like recv() or send() returns…
-
0
votes2
answers148
views -
0
votes1
answer123
viewsIdeal Weight Exercise (Language C)
Would anyone like to explain to me how I could be part of the "situation" in this exercise? how would I represent this in the algorithm? just need to finish, the rest works.. #include…
casked 5 years ago Luciano Balestrin Correa 71 -
0
votes1
answer103
viewsMenu creation in C program
Good afternoon, I’m doing a college job q has 7 questions... It’s almost ready, just need to fix some of them... I would like to put all the exercises in one program, putting a menu of them dividing…
casked 4 years, 12 months ago Matheus Figueiredo 1 -
0
votes0
answers30
viewsOn-screen Print Error
Good afternoon, I’m developing a console application for a university paper. The goal is to create a stock management application of a pharmacy using C language. I created the function of adding new…
casked 4 years, 11 months ago MachineTheGod 53 -
0
votes2
answers42
viewsMiscalculation with While
In this exercise it is to type two numbers and print on the screen themselves, and the integers between them. However, if I type for example 10 and 20, the last number that appears is 19 instead of…
-
0
votes0
answers35
viewsNumber of cases in an age range (allocation problems)
The user will provide multiple (first given number) triple entries with the first number being 0, the second number being the number of disease cases at a given age (third number) or the first…
-
0
votes1
answer267
viewsExercise with counter problem
The exercise needs to be done with while or while, in C language.. A city hall conducted a survey among its inhabitants, collecting data on salary and number of children. The city hall wishes to…
casked 4 years, 11 months ago Luciano Balestrin Correa 71 -
0
votes0
answers60
viewsHow to decrease running time using openmp
I wanted to know what I can do to decrease the running time using Openmp threads. I made a code to add the values of a size 2² vector, but the time measures are practically equal when I increase the…
-
0
votes1
answer159
viewsFunction in struct in C
I want to transform the whole process of input and output of the structure into functions, but I’m having problems with the result that returns, I believe it is something because the function is as…
casked 4 years, 11 months ago Lucas Anjos 11 -
0
votes1
answer44
viewsHow can I improve?
I started learning C a few days ago and created this program, which in a simple way calculates a person’s salary after receiving some data from it... However I don’t work in the IT area and I have…
casked 4 years, 11 months ago user185128 11 -
0
votes1
answer85
viewsDynamic Char Allocation with pointers
I am a beginner in C and I have a question that I am not able to solve the way I would like and I wanted to know why this. Contextualizing, I have to make a run that changes the positions in an…
casked 4 years, 11 months ago José Victor Silva 53 -
0
votes2
answers498
viewsHow to delete the terminal from what was written when running a C program?
People I am with a tremendous doubt. When I run a program in C it shows the information that are in the terminal. But then I want to delete what was written to show a new information. I have done…
-
0
votes0
answers26
viewsProblems in a stack whose positions should be selected? ( Warning: implicit declaration and Warning: Pointer from integer)
Hello, today I bring here a question related to data structures that surely can add in the understanding of all envovilido. It is a matter of pile manipulation where through the act of traversing…
-
0
votes1
answer42
viewsHow to create a parameterized variable?
In one exercise I must create a valid number for credit cards "Luhn’s Algorithm". need to create a parameterized variable to avoid using if, but the code gets too big and I want to reduce it I can’t…
-
0
votes0
answers923
viewsError: "The expression must be a modifiable lvalue"
Hello! I’m learning C, and I’m trying to make a simple program, which consists of a "Stack of Books" in which I need to Store the Book Title, Author and Book Code, using structs and Stacks of Data.…
-
0
votes2
answers116
views -
0
votes1
answer209
viewsFunction that transposes a matrix, using passage by reference
I need to do a function that by passing a matrizA by reference, the matrizA would turn the transpose of the matrizA. I tried using an auxiliary matrix, only it’s not working. It has to be a 5x5…
-
0
votes1
answer142
viewsstruct function parameters
I am making a code that calculates the sum and subtraction of complex numbers, however, I cannot find the error to compile. #include<stdio.h> #include<math.h> typedef struct NI { float…
-
0
votes1
answer48
viewsImproper storage in the vector
I’m having trouble solving this algorithm in c. I need the user to type 10 numbers, and check if the number is even or odd. store these numbers in two distinct vectors, one for even numbers and one…
-
0
votes0
answers20
viewsArray sorting in C -- Error in float version
For some reason I don’t know, when I change the type of my int function to float it just doesn’t work properly: void organizeArray(float array[], int size){ int aux; for (int i = 1; i < size;…
-
0
votes1
answer47
viewsHow to apply the same condition/operation for each element of a vector in C
Hi, guys! I need to perform the same operation for all elements of a given vector. How to do this? More specifically, I need to check if an element any "x" has, in its two adjacent positions larger…
-
0
votes1
answer155
viewsUse of switch case to choose a function
I would like to use the switch case to choose which function will proceed with the program. The program has 3 functions: a sum function, another multiplies and the last one is responsible for…
-
0
votes1
answer29
viewsSegmentation fault error when printing 2D array - loop is not sending values to array
I’m not getting why of this error, Segmentation fault. Segment error, apparently. I have a code in which the user sends values that are recorded in an array. This array has two dimensions, the 2D…
-
0
votes4
answers48
viewsChar variable is not receiving values in C
Good afternoon, everyone my variable char z is not working with either scanf_s or gets_s. With the scanf it generates an exception and locks the program, using gets_s at the time of entering the…
-
0
votes1
answer70
viewsHow to put color in text
This is the statement: In a college, students with an average of at least 7.0 pass, students with an average of less than 3.0 fail, and others are recovery. Given the two notes of a student, prepare…
-
0
votes1
answer96
viewsScreen Printing Problems (C Language)
I’m doing a job where it’s requested: The system to be built will need to meet the functional requirements below: 1 - Have your ID (RA-Name-Course) 2 - Have an option menu. 2.1 - Include the…
-
0
votes1
answer56
viewsProblems with the <string. h> library
Good evening, everyone! I am developing a work of college using functions, structs and files, and I am having problems exactly with the library <string.h>. Basically, the user registers and…
-
0
votes1
answer39
viewsConflicting results passing an Array as parameter
The idea is to create a function that, given a one-dimensional array/vector, returns the number of elements present in that array/Array: #include<stdio.h> #include<stdlib.h> #define MAX…
-
0
votes1
answer80
viewsConvert for to while
#include <stdio.h> #include <stdlib.h> int main(void) { int X[10], cont; cont=0; while(cont<10){ printf("Digite um numero inteiro: "); scanf("%d",&X[cont]); if(X[cont] %2 == 0){…
-
0
votes1
answer45
viewsInterpolated search in C, repeated values in the arrangement
I’m a beginner/student in C language and I’m learning about search. I’m having difficulty understanding about the interpolated search, because the test code I passed in the discipline presents error…
-
0
votes1
answer75
viewsHow to store numbers in a vector to display it later in C?
I have to make a code in which the user type 20 values, I must count the values greater than 10 and then display them later. I am able to count how many values are greater than 10, but the display…
-
0
votes2
answers126
viewsFactorial calculation in an arithmetic progression
I need to create a program that calculates the factorial started with 2 and add 2 more to each repetition until it reaches 20 times. Ex: 2!, 4!, 6!, 8!... I tried several ways, but every time I…
-
0
votes1
answer133
viewsHelp with C registration program
I’m doing a program that reads customer data and stores it in covenants, which can be searched through the person’s code or simply their name. It’s not finished yet, but the problem is when the…
-
0
votes2
answers478
viewsSearch in file . txt
I’m doing a college paper that’s asked to do a library book registration system, The whole part of the registration is already ready but the research part is missing, which is where I don’t know how…
-
0
votes2
answers2230
viewssetlocale(LC_ALL, "English"); does not work in Visual Studio 2019
Good night to you all, I did a lot of research on how to solve the Portuguese language accentuation problem that occurred shortly after upgrading to windows 10 but to date unsuccessful. I will post…
-
0
votes0
answers40
viewshelps store csv value in a EM C vector
#include <stdio.h> #include <stdlib.h> #include <string.h> int process_field2(int fcount, char *value) { int vetor[36]; if (fcount == 0) { for (int k=0; k<36; k++){ vetor[k] =…
casked 4 years, 9 months ago lucas horns 1 -
0
votes1
answer112
viewsI need help with my Roman number code (C language)
Well, I created this code as a draft form for the project I have in which it turns certain words into decimal values, but I did it with Roman numerals pq is easier that way for now, but there’s a…
-
0
votes1
answer122
viewsBubblesort reading and sorting of csv file in C
I am doing a work for the course and one of the questions is to make a code in C to: read a csv, sort it (using the Bubblesort method) and print on screen. I have this code that serves as a basis,…
-
0
votes1
answer98
viewsHow to generate 10 times random numbers without being repeated, with loop?
#include<stdio.h> #include<stdlib.h> #include<locale.h> #include<conio.h> #include<time.h> #include<windows.h> int main(){ int nSorteado[6]; int i, j, n1, n2, op,…
casked 4 years, 9 months ago Thaina Lopes 13 -
0
votes1
answer214
viewsPrint Matrix (C)
I’m trying to print a matrix over the months, but I’m not getting it. It’s a test for another code I’m doing. The goal is to stay: Janeiro Fevereiro Março Abril Maio Junho Julho Agosto Setembro…
-
0
votes1
answer443
viewsError '''Segmentation fault core dumped'' in C
I’m a little new, but I haven’t been able to solve that problem yet, so I came to you. I use linux and I have a problem with the code I made (it’s very simple). The code reads a number and…
-
0
votes1
answer149
viewsHow to call function in Assembly inline from code in C and vice versa
I am using the MASM syntax to make the codes below. I tried with this function, for example: __asm( "soma:\n" "push ebp\n" "mov ebp, esp\n" "mov eax, DWORD PTR[ebp+8]\n" "mov edx, DWORD…
-
0
votes2
answers56
viewsLoop "while" ending earlier than expected
The question says the following: Write a program that reads the side of a square and then print the square with asterisks. Your program should work with squares of all sizes between 1 and 20. For…
-
0
votes1
answer179
viewsC code skipping user input
Hello! I am Newbie and I am trying to make a program to read a list of information inserted in it. Until the first line it works, but from the second register he no longer reads the name, putting…
-
0
votes0
answers153
viewsOutput badly formatted accented C characters in Visual Studio Code
Although it is importing the library referring to accentuation, the outputs of the accented characters come out totally unnoticed of the normal. This problem only happens in Visual Studio Code, the…
-
0
votes2
answers72
viewsThere is some difference between these two ways of Bubble Sort°
Is there any difference between these codes? that: void bubble_sort(int array[], int n) { int count = -1; while (count != 0) { count = 0; int aux; for(int i = 0; i < n - 1; i++) { if(array[i]…
-
0
votes1
answer31
viewsWhy is the output value of half incorrect?
Hello, the output that shows the value of the variable half appears to be an address instead of the value float, I cannot identify the error, someone can explain me? #include <stdio.h>…
casked 4 years, 8 months ago Engenheiro Nóia 1