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
votes1
answer870
viewsDouble chained list - C
People this code is giving error in libraries, someone can help me? # include<stdio.h> # include<stdlib.h> # include<string.h> # include<ncurses.h> # include<curses.h>…
casked 6 years, 12 months ago Cristian Kirsch Foesch 1 -
0
votes1
answer674
viewsReceive a Long String with esp 01
I have a esp 01(Wi-fi module) connected in my Arduino on port 2 and 3(TX RX), I can send a large String, but when I receive I can only receive at most 32 characters, here is the code of my Arduino:…
-
0
votes0
answers30
viewsError showing a String
I’m asking the question Entry and Exit with Comma, I’m doing everything the question asked but I’m leading 30% error, could help me where the error may be My code #include <stdio.h> #include…
-
0
votes2
answers190
viewserror: cannot Convert 'int*' to 'main()::class*' in assignment
I am trying to compile my code and presents the error reported above error: cannot Convert 'int*' to 'main()::class*' in assignment" on line 21 (ptr_turma =(int*)malloc(sizeof(int)*100);) Follows…
casked 6 years, 11 months ago Priscila Cervo 1 -
0
votes0
answers397
viewsInfixa to Pósfixa conversion - C STACK
Code that should be given an arithmetic expression in infix notation (common) for postsphere notation (reverse Polish). For example, when receiving (A+BC) he should print ABC+. The problem with my…
-
0
votes0
answers177
viewsC - Stack Smashing Detected - How to correctly initialize a graph by adjacency list and insert edges?
I am receiving, sporadically and without having made any changes to the code or input, an error called Stack Smashing Detected. The only things I’m doing is initializing a graph and inserting an…
-
0
votes1
answer272
viewsListing by name in a struct
Good afternoon. I’m stuck with a job I’m doing. The work consists of: creating a student registration system, where the user registers the name and registration of the student. During the data…
casked 6 years, 11 months ago Guilherme Bruno 1 -
0
votes1
answer226
viewsTrouble sorting code with Shellsort
#include <stdio.h> typedef struct { int id_submissao; int tempo; int id_equipe; int id_problema; char status; } Linha; void shellSort(Linha *v, int n) { int i = (n - 1) / 2; int chave, k, aux;…
-
0
votes1
answer63
viewshow to pass two structs per function
I have two structs, one for the student data and one for a hash table, where the collisions of the matricules go. To know if there was a precise collision of these two structs ,but dev says that…
-
0
votes1
answer32
viewsThe system is not reading the requested line
I made the code below to read simple date information, but when it reads the day, it strangely asks for two entries, and ends up going one to the variable diatemp and the other to the mestemp,…
-
0
votes0
answers78
viewsDoubt when creating structs, relating one struct to another
I created the following structs: typedef struct cliente{ unsigned long int codigo; char nome[50]; char endereco[50]; char cpf[11]; char idade[3]; struct cliente* prox; }Cliente; typedef struct…
casked 6 years, 11 months ago Yuri Carlos 1 -
0
votes2
answers855
viewsDistance calculation in C
The question asks to calculate the shortest distance between cities. It was given the geographical coordinate of each region. The right way out would be: 1646.3 189.9 My exit showed incorrect value…
casked 6 years, 11 months ago Jorge Oliveira 3 -
0
votes2
answers74
viewsFunction ends before asking for scanf value
Can anyone figure out why when in the function accepting users I call main(), main() does not scan? That is, when I call the main again it does not let me choose any option and immediately closes…
-
0
votes2
answers1061
viewsRemove element from a Vector in "C"
I must fill two vectors, A and B, with 10 elements each, then do the Interseccao and the Union, in the union, I must remove the repeated elements. At the time, the intersection was made, within the…
-
0
votes1
answer1490
viewsHow to create simple circular chained list in C ?
NOTE: The first element I am inserting outside of here, this is pro second from now, the while will run until the user type the id of a student -1 q ta in the create function. It’s falling in…
-
0
votes1
answer51
viewsSegmentation Fault
I would like to dynamically allocate memory without informing the amount of elements that a vector would have. #include <stdio.h> #include <stdlib.h> int cardinalidade(char *conjunto) {…
-
0
votes1
answer274
viewsProblem creating Minimax in chess game
I am coding a chess game only in pure C. The game itself is ready, I am for some time trying to develop the algorithm of Minimax. Currently the algorithm is almost ready, but it is not returning and…
-
0
votes1
answer39
viewsInsertsort in Double Chained List... without success
I am trying to implement the Insertsort method but so far unsuccessful.. someone could give me that strength? void insertionSort(ListDN *l){ int ordered = 0,i,j; Dnode *cursor = l->head->next…
casked 6 years, 11 months ago Dorizio Filho 1 -
0
votes1
answer61
viewsinsert names neatly into a list, I’m not aware of this
//function of inserting there; there only does it with the 3 first names, the others it does not order Aluno *cad(Aluno *aluno) { Aluno *aux; while(1) { aux = aluno; if(aux->prox == NULL) { Aluno…
-
0
votes1
answer156
viewsHow to pass, by reference, a vector of structures to a function?
I’m having great difficulty understanding the reference passage of a structure vector. No running error happening, but not sure if I am reading the file correctly there. #include <stdio.h>…
-
0
votes1
answer76
viewsNull list error
Guys I’m having a problem, my code is running right option 3 only the first time if return to the menu and try again it appears nulla. O case 3 is to list names in alphabetical and reverse…
-
0
votes1
answer7113
viewsEliminate repeated elements of a vector in C
I have to make an algorithm in C that takes user values and armzazena in 2 different vectors (X and Y) and then shows the union (all elements of X and Y without repetitions), the difference (all…
-
0
votes1
answer127
viewsInvalid operators in a binary expression C
I have a problem here I’m trying to average my vector class_points, but it gives me a mistake and I do not know how to solve. Someone could enlighten me a little? int better_than_average(int…
casked 6 years, 10 months ago user114598 -
0
votes0
answers62
viewsSeparate a string in 2 from a file
I’m having trouble separating a consulted string from a file into two. the file is so alex 6461 anddre 979794 Douglas 6469794 Gustavo ... i want to pick the characters picked up on the line and…
-
0
votes3
answers1105
viewsReading Struct Strings with Wrong Scanf
Good guys, I am developing a C code that performs data registration in files. However, I have a problem in the function register, which you will see below among the codes. Struct of the client:…
-
0
votes0
answers77
viewsError: Segmentation fault - Dynamic matrix allocation
I intend to use this function to dynamically allocate and populate an array, of indeterminate element size, where each row has only two elements, that is, an ordered pair. int **lePares() { int…
-
0
votes1
answer109
viewshelp setting char inside the if in C
Hello, I’m trying to set the char variable filename[100] inside if, but the compiler error, but if I set it outside of if it works good, any pls help? (#defines are stdio. h stdlib. h time. h and…
casked 6 years, 10 months ago Paulo Henrique Rodrigues Grund 317 -
0
votes2
answers38
viewsProgram with Warning and does not perform what was requested
Good night! When I was studying for the test I’m going to take, I faced that question. However, when I performed the program, I did not realize what I did. I would like you to see my code in order…
-
0
votes2
answers74
viewsexclude people names from a C array
Hello. I have a C algorithm to delete a user but not interact in the array: #include<stdio.h> #include<stdlib.h> #include<locale.h> #include<conio.h> #define numeroUSER 100…
casked 6 years, 10 months ago André Nascimento 1,258 -
0
votes0
answers147
viewsIn C, how to compare a string obtained from Strtok to another string
Well, folks, in my progress in C language study, I’m working with file manipulation, nothing too complicated, but I’ve come up with a problem I can’t solve, For lack of more definition in searches…
-
0
votes2
answers203
viewsFind the most frequent character in a text
I did so, but I would like printf did not keep repeating... There is some way to display only the most frequent character? #include <stdio.h> #include <stdlib.h> int main() { char…
-
0
votes1
answer8098
viewsStack error Smashing Detected in C
Could someone help me on the following question: Create a program that fills a 6x4 matrix with integers, calculate and show how many elements of this matrix are greater than 30, and then assemble a…
-
0
votes0
answers48
viewsError in C list of structures
I’m working on a list of structures code, where I have a structure called Cad that contains the registration fields, name and salary. And a list containing a field of type struct Cad that stores the…
-
0
votes1
answer52
viewsSegmentation fault na Function read_line
I have a Function that returns a string from a row of a file, but when I run it I get a message from Segmentation fault. Here’s the code: #include <stdio.h> #include <malloc.h> #include…
casked 6 years, 10 months ago Carlos Henrique 77 -
0
votes1
answer54
viewsDifficulty accessing elements in a C vector
In the following code I try to obtain the largest element of a vector. However, when trying to access the elements of the vector I can access only the index 0 and consequently cannot access the…
casked 6 years, 10 months ago Aislan Silva Costa 83 -
0
votes1
answer825
viewsHow to implement a generic Mergesort sorting algorithm?
How to implement an sorting algorithm Mergesort generic (with function pointer and pointer void) in that capacity? #include<stdio.h> typedef struct{ inta; intb; }XPTO; void criaVetor(XPTO∗v,…
-
0
votes1
answer263
viewsHow to change a string name
I’m asking a question in Rio Tag replacement, that one has to replace one name with another but I’m not succeeding, I can only with normal names without characters My code #include <stdio.h>…
-
0
votes0
answers70
viewsDoubt about records in C
Hello I have a doubt in this exercise in the last sentence, this asking to make a list but n says it is to put in the record but I am putting the list inside the record to save but n know if this is…
casked 6 years, 10 months ago Igor Vargas 274 -
0
votes2
answers302
viewsDoubt FILE in . h
Good friends, I am new to the platform, so I don’t know if I am in the right place. But I would like a help. My problem is to make a program that copies a txt file to another text file, with the…
casked 6 years, 10 months ago Gustavo Pavanati 3 -
0
votes1
answer1802
viewsDereferencing Pointer to incomplete type
How can I resolve the problem of "Dereferencing Pointer to incomplete type"? I can’t find where the error would be. The following is the statement:. typedef struct{ int dia,mes,ano; }data; typedef…
-
0
votes1
answer323
viewsHow to compare two vectors and exclude equal values from the vector with the highest number of characters? In "C"
Generate and display sets A - B and B - A A and B are both vectors with user-defined sizes A -- allele values B -- user defined for example: vector A= (10),(5),(7),(8),(12) vector B= (10),(8) A-B…
-
0
votes0
answers55
viewsMount a program that displays user-typed impressions
Guys, I’m having trouble putting this together using the for, I know how to make a program that displays even or odd numbers up to the number typed but how do I make it so it can display how many…
casked 6 years, 10 months ago Rafael Lucca Magalhães 11 -
0
votes0
answers225
viewsInsert at the beginning of a circular row
I am working on a circular queue program where I want to implement a "queue break" function, where the user inserts a number and this number should be inserted in the queue spaces prior to f.com.…
-
0
votes1
answer547
viewsCheck whether a string is contained in another string without the string library. h?
I need to check if a string is contained in another and returns the position at which the first letter appeared. I saw here on the site the following code, but I can not use the library string.h.…
-
0
votes1
answer110
viewsI need an explanation why the C code gives a Segmentation fault error
I started my dynamic allocation studies but I’m not able to make a simple example, I couldn’t find the problem. #include <stdio.h> #include <stdlib.h> #define SUCESSO 1 #define FALHA -1…
-
0
votes2
answers32
viewsAfter typing the P Value, you are not running the printf of the second for
#define MAX 15 #define TAM 2 struct { char m[MAX]; int ano; float v; } car[TAM]; int main(void) { int i; int p; for(i=0; i<TAM;…
-
0
votes1
answer129
views -
0
votes0
answers122
views"SIGSEGV ON THREAD", can someone help me to solve, and also, if possible, to complete the program?
Here’s the thing, I do an info tech, and I’ve been learning C for just two months, and I don’t know much yet. Recently my teacher asked me to make a program in which user entered with two numbers…
-
0
votes2
answers717
viewsHow to separate vowel consonants into a matrix in C
Hello, I have a problem with my code. I have a matrix[6][3] that reads letters, after reading I want to separate the vowels from the consonants. However I did not succeed because all the letters go…
-
0
votes0
answers59
viewsHow do I pass the values stored in a truck so another function can modify it?
I’ve been trying to make this project run since yesterday, but I can’t manipulate the data of my struct when I move it to another function, the other function simply create other values, the goal of…