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
votes0
answers37
viewspython sigint and Ctrl c have different effects
Hello, I need to run an executable done in c,this executable performs operations on a board and writes to a file, the problem is that the write event occurs when the program receives a Ctrl+c. I…
-
1
votes1
answer755
viewsRecursively counting sequence of numbers in a C matrix
So I have the following problem: I need to count how many decreasing sequences of numbers there are in a matrix recursively, but it is only considered a sequence if it is completed to number 1. Ex:…
-
1
votes1
answer206
viewsError with C Strings
The phrase "TYPE THE STREET" should only appear immediately after being inserted what asks the "ENTER A NUMBER FOR CONTACT". What must have happened? #include <string.h> #include…
casked 6 years, 4 months ago Diego Roney 127 -
1
votes1
answer255
viewsStruct and matrix, how to relate?
I’m doing a code for a college paper and a question has arisen about how to assign values to a matrix of the type struct. struct posicao { int x; int y; }; struct posicao inimigo_val[5][15] = {…
-
1
votes1
answer127
viewsHow to store a chained list
Hello, I have some questions that I will illustrate below: Having two double chained lists A and B with the structure struct lista { Ponto* dado; /* dado = número */ struct lista *prox; /* ponteiro…
-
1
votes1
answer120
views -
1
votes2
answers209
viewsWhy isn’t the break working?
Enunciation: Read a 5x5 matrix. Also read an X value. The program should do a search for this value in the matrix and, at the end, write the location (row and column) or "not found) message" Code:…
-
1
votes1
answer108
viewsC code, url=inet_ntoa(*(struct in_addr *)ip->h_addr); I don’t understand what’s going on
I was studying sockets for this stuff https://www.exploit-db.com/papers/13634/ and I came across a code that I don’t understand what’s going on. That’s the part of the code: struct hostent *ip; ...…
-
1
votes3
answers497
viewsChar pointer in printf() does not work
I decided to make this code simple, where I have an empty vector and a function that fills it only with a letter that the user type, but I’m not able to print. If I wear that printf() commented, it…
-
1
votes2
answers1393
viewsLoop problem with switch case
I reread the code following the guidelines given here. However, it has had the initial problem again... I choose the desired option, it performs the desired action but soon after it goes to the…
-
1
votes1
answer339
viewsCheck if the number typed is already present on the struc
Good afternoon, I’m facing the following problem. I need to make an algorithm for registering bank accounts of 15 people with the following information: account number, name and balance. However it…
-
1
votes1
answer55
viewsProblem on game startup
I’m trying to run a game I made in Allegro 4, the application only runs normally in the first compilation/execution. If I close Devc++ and open again or try to run the generated . exe file, the game…
-
1
votes1
answer865
viewsRecursive heapsort in C
I have a heapsort, and would like to implement it recursive. What I need to change in my algorithm? void criarHeap(int v[], int inicio, int final){ int aux = v[inicio];//v[pai]//inicio=pai int filho…
-
1
votes1
answer65
viewsFile with strange characters
I have a string that receives a keyboard input value and a file that contains a string. What I need to do is compare the typed string with the file string and check if they are the same, but I went…
-
1
votes1
answer42
viewsOrdering With a certain condition
I made the point Who’s Going to Fail? that had the rule Students would be ordered according to the number of problems solved, with draws solved according to the alphabetical order of the names…
-
1
votes1
answer349
viewsCheck if an expression is well formed
I was trying to make a program that checks if an expression is well formed. Something like {[()()]} is well formed while something like {{())({] is not. I implemented a bilbioteca "cell. c" from…
-
1
votes0
answers106
viewsOverflow in unsigned long int - C
The unsigned long int type stores a maximum value of 4294967295 (2 32 - 1) while the float value stores a maximum of 10 38. I’m doing an overflow test on an unsigned variable long int. Look at the…
casked 6 years, 3 months ago Lucas Lopes 89 -
1
votes0
answers154
viewsWith show even items in a C list
I have a question in this exercise. I tried several ways but I do not know how to take the position of the pointer to use the content in this case. • Describe steps for creating a new element in the…
casked 6 years, 3 months ago Igor Vargas 274 -
1
votes2
answers412
viewsRemove elements from the end of a list in C
I’m having a problem where my list is removing all the elements and leaving only the last and last. #include <stdio.h> #include <stdlib.h> typedef struct LISTA{ int dado; struct LISTA…
casked 6 years, 3 months ago Igor Vargas 274 -
1
votes1
answer103
viewsBinary tree printing only left side
Hello. My binary tree is printing only the left side, what can it be? I am using TAD to implement. Tree structure: typedef struct _no { int conteudo; struct _no *esquerda; struct _no *direita;…
-
1
votes1
answer799
viewsC / How to exchange for a while?
Write the function prints using the while repeat structure instead of for. If necessary I can edit and insert all the code. void imprime(Ccc *p) { Ccc *r; for (r = p; r!=NULL; r = r->proximo)…
-
1
votes0
answers53
viewsLogic about recursive return
Hello guys I am studying binary tree search and recursiveness is very used in this type of data. I have a question, for example, I did the following function to search for an element in the tree:…
-
1
votes0
answers438
viewsInterlink a chained list in c
Hello I’m trying to do an exercise where I need to interlink 2 chained lists. But my function is only returning a number only. The function is the intercale(); insira o código aqui #include…
casked 6 years, 2 months ago Igor Vargas 274 -
1
votes2
answers78
viewsDoubt if Else returning 0
I’m trying to do the following exercise: 10)A fruit plant is selling fruit with the following price list: Até 5 Kg Acima de 5 Kg Morango R$ 2,50 por Kg R$ 2,20 por Kg Maçã R$ 1,80 por Kg R$ 1,50 por…
-
1
votes1
answer41
viewsUnzipping of characters
I’m having difficulty in the following exercise Using the right shift operator, the AND operator over bits and a mask, write a function called unzippaCaracters that receives the integer unsigned and…
-
1
votes1
answer605
views"Printf not declared in this Scope" even with the use of #include <stdio. h>
Why am I getting the error message : [Error] 'prinft' was not declared in this scope related to line 22 of the code below, if the first thing I did was declare: #include <stdio.h>. I am using…
-
1
votes1
answer14836
viewsHow to calculate the sum of each row of a matrix in C?
I need to create an algorithm that reads the dimensions of a matrix, read the values to be placed in the matrix, with a vector calculate the sum of the values of each row and print the matrix and…
-
1
votes1
answer85
viewsDoing BMI calculations I’m not getting just the result 80
#include <stdio.h> #include <math.h> int main() { float peso,altura,imc; imc=0; printf("digite seu peso ?"); scanf("%f",&peso); printf("digite sua altura? ");…
-
1
votes1
answer1151
viewsProblem with struct: "Expected Expression before"
The following problem expected Expression before 'eqp' at the line of the data function where the value is read and I could not identify the reason for this. #include <stdio.h> #include…
-
1
votes0
answers187
viewsProgram does not run both For links within if - C
I have 2 ties for within a if, as shown below: if (grid[j][k] == words[i][0]){ int el = j, col = k; //Metodo direita, baixo for(l=0;l < wordlen(search_word);l++){ if(l%2 != 0 ){ // Procura à…
-
1
votes2
answers764
viewsProblem with Printing Repeated Numbers in C
The question asked me to make a code that would store 10 integer values, check if there were any repeated numbers, and if there were, print the repeated numbers, but my code or print some repeated…
casked 6 years, 2 months ago Ana Karolina 31 -
1
votes3
answers367
viewsReturning(Null) when displaying a String variable
The program must receive the name of a person and sex and show the data typed by the user, but when the program shows the name I typed is appearing Null instead of showing the name. #include…
-
1
votes1
answer62
viewsExecution error on switch
#include <stdio.h> #include <math.h> int main () { int n1, n2, operacao, soma, sub, mult; float div; printf("Escolha a opecaracao que deseja realizar: ");…
-
1
votes0
answers219
viewssend Arduin integer number with esp8266 to mysql
I have an error when I send via ESP8266, the integer value with the name number, my code is as follows: #include <ESP8266WiFi.h> // Use this for WiFi instead of Ethernet.h #include…
-
1
votes1
answer72
viewsDifficulty implementing chess board
I need to implement the code that manages a chess board in ppm. It would be in the standard 8x8 format, with the option of the user to set the pixel number, the doubt would be when to loop to…
-
1
votes0
answers330
viewsError of Memory in Python
I’m tempted to days solve this problem and can’t, my scripts works on various python machines, but on the server I need to run the application and presents the error, I’ve left a memory test running…
-
1
votes1
answer32
viewsDouble-linked and circular list, memory errors with Valgrind
I have the following structures: typedef struct Node { char info[40]; struct Node *ant; struct Node *prox; }NoCDup; typedef struct LDEC { NoCDup *cabeca; NoCDup *cauda; int tamanho; }ListaCDup; And…
-
1
votes1
answer63
viewsString marking and value return
Here is my program, I need to register up to 100 products, each product is available in 5 stores and I need to say the quantity sold of each product in each of the 5 stores. I will have a menu that…
-
1
votes1
answer1293
viewsRead from txt file to char vector
I have a file dados.txt with (fictitious) Cpfs in the following format: 382031758-71 647900189-01 460754503-73 696170135-72 And so on, being in total 500 cpfs. I’m trying to read each and put in…
-
1
votes5
answers114
viewsLogical error while using If/Else
I’m trying to get my program to identify a triangle and tell me if it’s equilateral, isosceles, or scalene. I’m a beginner in the C language, so I created a structure with If/Else to analyze the…
casked 6 years, 1 month ago Matheus S. Gomes 13 -
1
votes1
answer1139
viewsRead only whole numbers in c
I’m new to programming and I’m having a problem, I made a code that reads three whole numbers. #include <stdio.h> #include <stdlib.h> int main () { int i,v[3]; for (i = 0; i < 3; i++)…
-
1
votes1
answer193
viewsRepetition system how to store a value
Make a program that receives the age, height and weight of 25 people. Calculate and show: The number of persons over the age of 50; The average height of people between 10 to 20 years; The…
-
1
votes2
answers112
viewsProblem banknotes and coins
The given question required that scanf be used to read a certain floating-point value from 0 to 1000000 and print how many 100, 50, 20, 10, 5 Reals and 2 Reals, and how many 1 Reals, 50.25, 10.5.1…
-
1
votes1
answer63
viewsHow to parallelize (Openmp) a method call?
So I’m developing a work to perform the comparison of a sequential and parallel execution of a Pattern Matching method. My input is a. txt of dozens of lines, which I traverse and store inside a…
-
1
votes1
answer97
viewsRemoving number by number from a sequence of numbers to compare them
My professor of algorithms and programming techniques passed an exercise in which a = "123567348" and from that I would say which numbers are even and which are prime. He said he would have to use…
-
1
votes1
answer62
viewsWhy is my C code that uses queue giving Segmentation fault?
Hello I must implement a queue that receives the name information and Cpf but only when I try to unroll something gives seg fault, without the row of the unroll wheel normal, but I do not see the…
-
1
votes1
answer30
viewsProblem with macro
I’m trying to solve the following exercise: Write a program that defines and uses the PRINTARRAY macro to print an integer array. The macro should receive the array and the number of elements in the…
-
1
votes0
answers30
viewsDivergence in reading
I made a sketch for Arduino MEGA, where receives data by Serial2 and displays in Serial, the communication happens but the byte sent is not the same as the received, for example: Send 0x01, receive…
-
1
votes1
answer575
viewsHow to use "if-Else" sets correctly in C?
I have a problem with this code in Devc++, because in my view the conditions part if-else is perfectly indented and organized (all if possesses its else and your keys). The error is in the last…
-
1
votes1
answer70
viewsProblem with repeated number removal algorithm on doubly chained list
Could someone help me with the following code? void removeRepetidos(Lista *l) { Elemento *aux = (*l); Elemento *aux2; Elemento *aux3; while(aux!=NULL) { aux2 = aux->prox; while(aux2 != NULL) {…