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
answer6449
views -
1
votes1
answer460
viewsEqual elements between vectors - C
I’ve been trying to solve a problem since early on: A school wants to know if there are students attending simultaneously disciplines Logic and and Programming Language. Put the numbers of the…
casked 6 years, 1 month ago Paulo Sergio G.M. Filho 141 -
1
votes1
answer321
viewsStruct vector: Passage by reference in C
This code is from a simple register of people, containing code and name of the person. I am confused about the passage from the struct vector to the "insert procedure". When compiling, the program…
-
1
votes3
answers98
viewsIncorrect reading of floating point
I have a file that stores products, each product has three information: its name (char *), quantity in stock (int) and its price (float). The information generated in my program I am saving in a…
-
1
votes2
answers226
viewsBuild error in C++ when accessing structure in function
I’m creating a code that holds the information of three people inside one struct, but I am having a build error when I will save the age option on struct. The mistake is this: /home/arthur/Área de…
-
1
votes2
answers65
viewsSum of n + last digit on the left
I have a recursion challenge. The goal is to return "n + the sum of the last digit on the left". Example: Input: 54321 Output: 54326 (54321 + 5) But the only way I could was like this: #include…
-
1
votes0
answers105
viewsReposition gotoxy(x, y) with C
I’m using the gotoxy function, so I can write in a certain coordinate: #include <stdio.h> #include <windows.h> void gotoxy(int x, int y){…
casked 6 years ago Gabriel Gonçalves 1,632 -
1
votes1
answer88
viewsCan sockets be multilingual?
Since sockets are a common choice for high-performance communication between applications of different platforms, my doubt is, that makes them also multilingual? Bringing the situation to my…
-
1
votes1
answer471
viewsArray of pointers with struct
I’m trying to assign 3 names to a string vector within a struct, and using pointers to reference the dynamically allocated struct, and then print and then reverse it into a repeat structure, but…
-
1
votes0
answers75
viewsReferencing a specific element of a bidemensional matrix via pointer notation
The C allows treating each row of a matrix of two dimensions considering them as a matrix of one dimension. As we know, one way to reference two-dimensional matrices in the form of C pointers is,…
-
1
votes1
answer72
viewsHow to remove the dot (.) from a character array?
I’m developing a program that reads an entire line takes the last three values and replaces the comma by dot and then turns this number to double. But I’m not able to develop a method if the number…
casked 6 years ago Amanda Santos 13 -
1
votes1
answer103
viewsProblem with string storage and printing in C
I’m taking words from a text file, and when it comes to printing them it’s all right, except when I store them in a vector. If I store them in a vector, at the time of printing, before the words…
-
1
votes0
answers21
viewsHow to generate limited number in c
I’m looking for a way to make some random numbers, and I have this code for now. I wanted to make random numbers of 26 to 100, and I’m not getting it... How could I do that? NOTE: I’m a newbie, and…
-
1
votes1
answer97
viewsLoop does not perform everything it should
I have a problem in my program, I need it to show randomly an order of numbers (teams). The problem is that when I put a number greater than 10 it doesn’t show the 10, it only shows a few: int…
-
1
votes1
answer742
viewsBubblesort - Lexicographic (Alphabetical Order) repeats the first name
I’m doing a name-ordering exercise with Bubblesort, but when ordered, the first name repeats. Example: I put to register 5 people: Ana Luiza Gabriel Esther Luciana And the ordination comes out as…
-
1
votes1
answer93
viewsLanguage C, matrix exercise
#include <stdio.h> #include <stdlib.h> int main() { int matriz[5][5]; int i, j, posicao=0; int maior = matriz[0][0]; int menor = matriz[0][0]; int posicaoI=0, posicaoJ=0, posicaoi=0,…
-
1
votes1
answer109
viewsHow can I subtract from a multi-position array with the same number in C?
The activity asks me to report a number of wagons and then asks me to assign a weight to each of them. I calculate the average of these weights and then subtract the average of the weights of each…
-
1
votes3
answers126
viewsVariable declared in main is not accessed inside another function
When I run the code below, it gives the following error: 'daluno' was not declared in this Scope Code: #include <stdio.h> #include <stdlib.h> #include <string.h> struct Aluno{ int…
casked 5 years, 10 months ago Bruno Gomes 19 -
1
votes1
answer101
viewsHow to run a Gtkmm C++ application on Windows without MSYS2?
To use (as far as I know) Gtkmm graphic libraries in Windows, I have to install such libraries in MSYS2. So far so good. Every time I install and write a C++ file and compile by g++ on MSYS2,…
-
1
votes1
answer192
viewsProblem with C code
I have a problem to solve in C which is as follows: Read a double precision number and calculate the minimum amount of 100, 50, 20, 10, 2 and 1 real, 50 cents, 25 cents, 10 cents, 5 cents and 1 cent…
-
1
votes1
answer137
viewsConvert a char array to an ints array
Basically I’m trying to store a sequence of integers. I used a char array for when I input a sequence of 21 numbers it takes over as a string and after storing each number in each char array space.…
-
1
votes1
answer79
viewsDate calculation error using struct tm
My software is incremented the date in 5 minutes and works perfectly the way I am doing, Searching I found a bug that only on 16/02 of this year the calculation is not correct, follows example:…
-
1
votes1
answer38
viewsProblem with search and insertion function
I tried to write the code below out of curiosity. For some reason, even after doing the functions of insertion and verification (checks if a value exists within the array), the return is that there…
-
1
votes1
answer60
viewsDynamic allocation in C
I’m making a base of a hangman’s game. I was trying to make a dynamic vector but it’s not working, it returns an error: [Error] invalid Conversion from 'char*' to 'char' Code: #include…
casked 5 years, 9 months ago Jonathan Gonçalves 13 -
1
votes0
answers42
viewsAllocate dynamic memory with multiple strings
My goal is to allocate memory "down", making a genre of an array, in which the string length is static Maxlength and the number of strings that is placed is used dynamic memory. #define MaxLength 35…
casked 5 years, 8 months ago Fábio Morais 1,522 -
1
votes2
answers47
viewsMatrix as parameter passage in C
Hello, my doubt is the following, I would like to know how I do in the code below, so that my matrix is read inside the main, and after inside the subprogram, a vector receives the values of this…
-
1
votes1
answer170
viewsAlgorithm to traverse an array
So I’m having a simple logic problem but I can’t find a good solution. Problem: I’m looking to go through a registry file (a .csv whose I have to solve a RMS - Root Mean Square calculation). But I…
-
1
votes1
answer116
viewsHow do you make an array of Labels in C/C++?
It is a fact that exists in Assembly (Nasm) and it is a fact that this is a quick way to follow to a point of the program among several. Here is an example code for x64 where you choose one of five…
-
1
votes0
answers77
viewsDeveloping application to communicate with Scanner using Windows image Acquisition (WIA)
I’m trying to develop an application that communicates with a scanner. In my research, I found in the Microsoft documentation a Service called Windows image Acquisition that allows this…
-
1
votes1
answer55
viewsVariable changes value without apparent reason in C
I’m writing a C code to solve the problem suggested in the Facebook post: https://www.facebook.com/groups/414761988665865/permalink/1390954547713266/ Can someone explain to me why you changed the…
-
1
votes1
answer50
viewsCan anyone help me find what is causing a build error in the code?
I went to solve exercise 1022 of Urionlinejudge and received a Compilation error, but the code works perfectly in Code::Blocks. Please inform me of the error. Link to the problem. #include…
-
1
votes1
answer930
viewsHow to end this program with EOF?
I was solving a Urionlinejudge site problem and it was asked for the input to end with EOF. I made the code perfectly, except that I don’t know how to implement the EOF. How can I do it? #include…
-
1
votes1
answer68
viewsProblem with adjacency matrix
I’m having a hard time printing the data from an array, I believe I’m saving the data the wrong way, so you notice the data was not saved because when I go to print no data comes back that I added,…
-
1
votes1
answer155
viewsTime Limit Exceeded
I wrote the code below to solve the problem 1112 from the site Urionlinejudge and apparently the logic employed is perfect, but I’m getting an error of time exceeded. I’m having trouble identifying…
-
1
votes1
answer82
viewsA float x==0 includes values like 0.7. How to change this?
Hello! I’m new to the programming world and I’m making a small calculator. I made an if that terminates the program if the user tries to divide by 0, but when I try to divide by for example 0.5 the…
-
1
votes1
answer228
viewsI don’t know why my program doesn’t work!! EM C
In the exercise I need to create a struct and send it to the function that checks if the number is even, if yes it sends to another function that returns the number /2. #include <stdio.h>…
-
1
votes1
answer413
viewsHow to calculate blobs in C?
How can I calculate a pixel zone in C? The pixels, R G B are given from a file. The user has to insert an R, G and B and a deviation as it is in the function to calculate zones. From that, you’re…
-
1
votes1
answer703
viewsI can’t dynamically allocate a struct vector in C
I don’t know why you can’t allocate!! struct dados { int numero; char nome[5]; }; typedef struct dados Das; void manipula_um_par (struct dados *a, int b) { a[b].numero = a[b].numero /2; } void…
-
1
votes0
answers87
viewsSorting Methods in C
I need to do a work with three modes of ordering in C and I chose a parking system with only the model and the make of the car but I am locked when creating the ordination. I want to take the…
casked 5 years, 7 months ago RayanneRamos 21 -
1
votes1
answer34
viewsLooping in a validation within a matrix
Well, I need to validate typed numbers so that my matrix matriz[5][3] accept only odd numbers, for this I used inside the loops for one do{ }while to have another number typed in case it was…
-
1
votes2
answers647
viewsSending Email with Arduino
I am not able to connect properly with gmail smtp server, says "Username and Password not accepted", but my email and password is correct, I am not knowing exactly where the error is. #include…
-
1
votes1
answer52
viewsI can’t find the reason why my code doesn’t calculate correctly
I’m starting programming now and to learn new things I’m trying to make a C code that calculates whether the user receives more or less than 3 minimum wages. However when doing the sum of the last 4…
casked 5 years, 7 months ago Izaac Borges 15 -
1
votes1
answer67
viewsDoubt in exercise with rule of 3
I’m making a list of exercises and in one of them I need to calculate the inflation of two commodities from one month to the next. I was able to do the exercise for when inflation is <= 100%, but…
-
1
votes1
answer367
viewsHow to remove the smallest element in a dynamic/chained C list (TAD)
"Create an unordered list TAD by implementing the minor function (removes the smallest element from a list) dynamic/chained". int menor_elem(Lista *lst){ Lista aux = *lst; if (lista_vazia(*lst) ==…
-
1
votes1
answer575
viewsC algorithm for registration, search and exclusion
Good night people, all right? I’m developing this algorithm and I’m having a hard time deleting names I’ve registered, I don’t have advanced C skills, and I don’t know if the way I did the code is…
casked 5 years, 7 months ago Lucas Souza 11 -
1
votes2
answers177
viewsDoubt in exercise with factorial and large numbers
I need to do an exercise that asks for the Y value given by Y = x + x 2/2! + x 3/3! + x 4/4! + ... , considering the first 15 terms. I’m having problems because the factorial results from the 10…
-
1
votes3
answers573
viewsincompatible types when assigning to type ‘tipoNo’ {aka ‘struct tipoNo’} from type ‘tipoNo *’ {aka ‘struct tipoNo *’} arv = inserir(&arv, 5);
I’m trying to implement the method of inserting a binary search tree. This is the struct I’m using typedef struct tipoNo { int chave; struct tipoNo *esq, *dir; //apontadores da esquerda e direita }…
-
1
votes1
answer36
viewsHow to get the data output in a file
I’m with a doubt, I’m only able to input the data by file, as it would be to get the output of the data in a file called "Output"? //abertura dos arquivos FILE *arquivo; printf("Informe qual arquivo…
-
1
votes1
answer80
viewsMy code does not run fully
Good evening, folks. I need to implement a program that always prints a sequence of three numbers where there can be no repetition. Ex.: t = 4. Expected output: (0 1 2) (0 1 3) (0 2 3) (1 2 3) The…
casked 5 years, 6 months ago Julia Manuela 11 -
1
votes1
answer127
viewsError Read access violation in visual studio function
Good morning, I have a project to do, it is almost done, but now I have created two functions that give me reading access violation error, and I am not able to solve the problem, someone can help?…