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
answers148
viewssave Fibonacci sequence in C
I need to do a program that keeps the first 100 numbers of the Fibonacci sequence on file. I was able to make the sequence right, but at the time of the program save the file appears only the number…
-
0
votes0
answers20
viewsRead file information and load it into a B tree struct
I have the task of reading a file and uploading its information to a B tree structure, in order to develop a search algorithm to search the information by name, but my difficulty is already in the…
casked 4 years, 4 months ago Guilherme Peres 11 -
0
votes0
answers30
viewsC - Where am I wrong? [Error] Id returned 1 Exit status
I’m making a code that lists the amount of customers, the type of fuel that each of us fueled, and shows me the percentage of customers who filled each fuel. It’s something very simple, since I’m…
casked 4 years, 4 months ago Gabriel Vitor 11 -
0
votes0
answers61
viewsProblem in placing the delete option in the simple list chained in C
How to put the delete option in the chained list by looking for the person’s name. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <locale.h> struct stNo…
casked 4 years, 4 months ago Robson Nunes 11 -
0
votes1
answer39
viewsDoubling element of a double chained list
I need to create a function that receives a Lita and duplicate all nodes on the list. then the list 1 2 3 4 would be 1 1 2 2 3 3 4. My attempt: void duplicaLista (struct tDescritor *lst){ struct tNo…
-
0
votes1
answer55
viewsI cannot get my program to calculate the change to 100 in the notes that my client puts. In C
I need a program that calculates change for a $100 bill. He asks to enter which notes I want the change and so calculates how many notes of each I need to change 100. Numbers must always be integers…
casked 4 years, 4 months ago Vitória Rocha 31 -
0
votes0
answers39
viewsProblem increasing array size within struct dynamically
Problem I am doing a test program that receives names of students and their grades, with the number of students being able to increase indefinitely, for this I used a struct with two arrays inside…
-
0
votes0
answers13
viewsProblem of Segmentation fault in Pset4 (Recover) of CS50
I’m with a problem in my code, because Every time I Try to run it I get "Segmentation fault", but I can’t find the error. The code is: #include <stdio.h> #include <stdlib.h> int main(int…
casked 4 years, 4 months ago marcusfelipe19 1 -
0
votes1
answer30
viewsTransposed matrix that takes non-integer and fractional values
I’m solving an exercise where I type values for a matrix 3x3, the print and also display its transpose. The problem is that I am not able to receive fractional values, and comma numbers. The code I…
-
0
votes1
answer35
viewsCan someone help me? I need to write a "reverse" function that reads the inverse of the vector using pointers. Example: typed 123, printed 321
#include <stdio.h> #include <stdlib.h> void inverte (int *original, unsigned int qtd, int *invertido){ } int main() { int qtd; int…
-
0
votes1
answer40
viewsYou need to indicate how many times the highest number has been read, but you’re not counting that
I’m not finding out how many times a certain higher number has been read. #include <stdio.h> int main (){ int i, num, maior = 0; printf ("Ao finalizar, digite '00', sem aspas, para obter o…
-
0
votes2
answers635
viewsVector with pointers ordered in ascending order in C
I’m having difficulty sorting in ascending order the values present in a vector using pointers, I tested and the problem is that it just shows the vector with the inverse typed sequence, and not in…
casked 4 years, 4 months ago Exotic 011 11 -
0
votes1
answer45
viewsPrint reverse stack
I need to create a function that prints a reverse stack. I did the void implementation pilha_inverted (Stack *p), but when I use pilha_pop the execution stops and is finished. The problem does not…
-
0
votes1
answer40
viewsQuestions about C-language loop/array
Hello! I did a basic program to calculate the averages of 4 students. The problem is that the result of it, in the final screen, appears the phrase "Insert 4 Notes student 5 here: " without having…
-
0
votes2
answers152
viewsOrdering values by pointers
Good, I was doing an exercise that asked to read 3 real numbers, order them and show in an orderly way. I thought making a function that uses pointers would be a good idea, but the program always…
-
0
votes2
answers364
viewsHow to calculate the number of times a word appears within a sentence
I’m trying to create a code in which I have to count the number of times a word appears within a sentence, but after a lot of searching and searching about, I can only find codes that use the fgets…
-
0
votes0
answers50
viewsExecution error in c
I have a problem with the following code: #include <stdio.h> #include <stdlib.h> #include <string.h> char **tabela_hash; int valorTotal=0; void inicializarTabela(int *pm) { for…
-
0
votes0
answers19
viewsHow to get out of a loop when inserting a word?
How do I exit the loop when typing the word 'END'. Currently he keeps asking for the other data repeatedly and when typing 'FIM' he does not terminate the program. #include <stdlib.h> #include…
casked 4 years, 4 months ago guilherme daniel 9 -
0
votes0
answers84
viewsHow to order a chained list in order of the code?
Good afternoon (or good evening) staff. I am with the faculty exercise of the theme "Simple Chained List", which I must sort increasing and decreasing by the serial number of the product. But I have…
-
0
votes1
answer81
viewsSimply Chained List - delete the first half of the list
Good afternoon, you guys. I hope I’m publishing it right, because I’m new to the forum and new to programming. So, on a question that I am, more specifically in "Simple Chained Lists", is that the…
-
0
votes0
answers44
viewshow to make a program in which a monetary value is entered and displayed on the screen the amount of banknotes and coins of each type will be used
Hello, I’m trying to perform a program in which, you have to ask the user to enter a monetary value( random ) and let be displayed on the screen the amount of banknotes and coins of each type…
casked 4 years, 4 months ago Alexandre lopez 21 -
0
votes0
answers25
viewsMy matrices do not appear on the screen in C
I need to make a memory game and I’m in the first part of it, where you need to create a null board and then distribute pairs of numbers in random positions. What I did is give the user 3 options:…
-
0
votes1
answer41
viewsDoubt about a String issue (C Language)
I wanted to ask a question about String, the activity asks me to print a sentence that was typed in alphabetical order, putting each word of the sentence in order. However, when I give Run in the…
-
0
votes1
answer48
viewsin C. I passed a vector to a function and changed it inside. Why didn’t you change my vector in the main function? because I passed a pointer
#include <stdlib.h> void matriz_transposta( int l, int c, int *matriz); int main (void){ int linha = 2, coluna = 2; int *mat = (int*)…
-
0
votes0
answers30
viewsWhy am I getting Segmentation Fault error
I’m learning C in one of the test programs I’m doing, I came across a problem. The challenge is to fill a vector[2][2] with values typed by the user, but this should be done by a function and using…
casked 4 years, 3 months ago Gustavo Araújo 1 -
0
votes0
answers30
viewsHow to correct fgets() that for the program
My code has two structs. One is inside the other. when I fill out the registration it gets the people[qtdPeople]. name however when it will receive people[qtdPeople]. home->street it to. I wonder…
-
0
votes1
answer86
viewsCan anyone help me choose a specific line from the matrix ? (c/c++ language)
I’m doing an activity and she says: (function - matrix and vector) Design a program that reads a 4x4 matrix and creates a 4-element vector consisting of the elements of a matrix line chosen by the…
-
0
votes0
answers98
viewsHow to calculate the bimonthly grades of 10 students
I have to make a code where you’re asked to develop a program that controls the bimonthly grades of 10 students in a classroom. The programme in question shall perform the following routines::…
-
0
votes2
answers814
viewsValidate CPF - C language
I need to generate a random and valid Cpf for a college job This is the code I’ve developed so far, it’s generating letters instead of numbers in the two-digit checkers #include <stdio.h>…
-
0
votes0
answers37
viewsSave and access data from structures within structures
Good evening! I am learning to program in c and I have a problem, someone can help me? typedef struct utente //Armazena o nome, número de utente, data de nascimento de um utente, assim como se se…
-
0
votes0
answers18
viewsHow do I make cum program to verify the code of a product in a supermarket box in C language?
I’m trying to make a C program that can not only validate the entire code of a registered product, but a certain sequence in any part of the product number. I mean, I want if the product code is…
casked 4 years, 3 months ago Daniel Silva 19 -
0
votes1
answer39
viewsMerge static lists in C
#include<stdio.h> #include<stdlib.h> #define tam 10 #define TAM2 20 typedef int Apontador; typedef struct{ int item; }Elemento; typedef struct{ Elemento elemento[tam]; Elemento…
-
0
votes1
answer55
viewsHow to make fwrite only write the character instead of the entire record?
I’m making a code that reads a file with records of fixed size (storing in struct hist), and inserts them into another formatting file so that they have variable size. To indicate that the struct…
-
0
votes1
answer62
viewsI can’t copy a string array to a string array in a struct
I’ve been racking my brain for hours, and I can’t seem to fix it. I want to copy a new string and place it in the first position of a string array in a struct. However, when I try to copy the new…
-
0
votes0
answers19
viewsC-struct occupies more memory space than the sequence of its members
No 1° example a struct occupies 16bytes: #include <Studio.h> int main() { struct horario{ int hora; int minuto; int *h; }; struct horario agora; int tamanho = sizeof(agora); printf("%d…
-
0
votes0
answers43
viewsI’m going into an infinite loop but I can’t find the reason why
I basically have a complete graph represented as an adjacency list, i have to find between all vertices a path between a specific vertex up to some vertex with interest = 1 where what I want to…
-
0
votes1
answer93
viewsUse if with matrices
The question ends up being logically easy, but I’m having difficulty knowing how to use the if condition in the values of the matrix, I don’t know how to do to mess with the values of the matrix. my…
-
0
votes0
answers37
viewsGenerate specific numbers in the matrix
So the question is a 4x4 matrix with 0s and 1s, but I was wondering if there’s any way I could get the matrix to print 0s and 1s in random orders, I just don’t know how and I was wondering if…
-
0
votes0
answers45
viewsComplicator does not give error, but the program does not start
I’m learning data structure with the C language, but I realized that I should study a little more struct and pointers, in one of the exercises that I was given is to create struct with day, month…
-
0
votes1
answer46
viewsCreate function to sort alphabetically
#include <stdio.h> #include <string.h> typedef struct s_pessoa{ char nome[100]; char matricula[100]; long int…
-
0
votes0
answers21
viewsC Structures insert made but cannot read
I have a struct typedef struct { int id; char nome[50]; int tipoUser; float vencimentos; int id_clinica; } Utilizador; into which I enter values using the following code: void…
-
0
votes0
answers31
viewsWrite implementation of function serie()
I am solving some programming issues, but I am struggling with this issue, if anyone can help me I will be very grateful. The question and the following. Write the implementation of the function…
-
0
votes1
answer39
viewsProblems to edit items within the struct
I have the following struct: typedef struct { int id; char nome[50]; int tipoUser; float vencimentos; int id_clinica; } Utilizador; I enter in the same values from the following functions : void…
-
0
votes1
answer136
viewsReturn minimum and maximum values of a vector
Encode the function minimax(v,n,a,b), that receives a vector v containing n real numbers and returns in a and b, respectively, the values minimum and maximum between those stored in v. The code I…
-
0
votes1
answer60
viewsDifficulties with Arrays
Hello, Good Afternoon. I am a computer student and I am having difficulties with a part of a code, which is for the delivery of a work of my course. void criar_cliente() { /// Número do dia do…
-
0
votes1
answer37
viewsFilter string array in C and count how many repeat
The program makes car rentals, it takes license plate and the type of car, both stored in two different matrices, as I do to get only the license plates of the luxury type cars. Code I’ve made so…
-
0
votes2
answers78
viewsHelp in solving the program
Goodnight, I would like to put between program to be given in C, but I think this is reading a file in txt and I just wanted to save and then could search selected that option. Someone can help ?…
casked 4 years, 2 months ago Joao Pereira 15 -
0
votes1
answer32
viewsstore two pieces of a string in two other strings
Basically what I need is to make a mini Assembly simulator. the information will be entered by the user thus: MOV A,30 then what I was thinking of doing was storing the first 3 characters of the…
casked 4 years, 2 months ago user220443 -
0
votes1
answer54
viewsHow to compile C programs in Visual Studio 2019 without opening a project or solution?
I’m new to programming and I’m trying to use Visual Studio 2019 to write C codes. But for that I need to create a project/solution within the IDE, Something that does not suit me because I am at all…
-
0
votes2
answers40
viewsdefine the function
I am doing a language exercise c and wanted to know if anyone can help me understand how I do this function without adding library i have no idea how to write it in the program,my doubt is how I…
casked 4 years, 2 months ago João vitor jun watanabe 21