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
answer36
viewsHow to return a pointer to a dynamically allocated String, declared within a function?
//Função de inversão de String. #include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZE 30 char* invertStr(char *source) { int size = strlen(source); char *inverted…
-
0
votes1
answer30
viewsMy program keeps going down
I don’t know why this is happening, but I need help figuring out why the program is crashing. My program aims to use Kruskal’s algorithm to find the lightest paths between cities (airports and…
-
0
votes1
answer47
viewsAlgorithm in C loop of for repeating response
Guys I’m going to college and I got stuck in a list exercise, it’s a C algorithm, could help me My problem is that I put a number to serve the variable x and it calculates about 4 times properly,…
-
0
votes1
answer61
viewsCall function to allocate vector in C
Hello, I’m creating a program to call a function that should allocate a vector to be used in main(), but I’m having difficulty, I imagine I should use a pointer to pointer, but I don’t have much…
-
0
votes1
answer55
viewsproblem when making a library
I made a code in a library and when I call her in the main it gives a mistake collect2.exe: error: Ld returned 1 Exit status follows the codes library. c #include "biblioteca.h" #include…
-
0
votes1
answer39
viewsadd to id +1 every time a new registration is made
add "+1" every time I register the program gives a constant id and does not change with a new registration void cadastroCliente(){ system("cls"); FILE *arquivo_cliente; CLIENTE clt; arquivo_cliente…
casked 4 years, 2 months ago Hugo LELIS 15 -
0
votes3
answers56
viewsSum of columns
I need to sum each column of a 3X3 matrix. What I got so far: #include <stdio.h> int main() { int matriz[3][3] = { { 5, -8, 10 }, { 1, 2, 15 }, { 25, 10, 7} }; int array[3] = {0}; for(int…
-
0
votes1
answer76
viewsa program that reads 30 pairs of integer values, storing the smallest value in a variable x and the largest in y
someone can help me develop this problem? Present a program that reads 30 pairs of integer values, storing the lowest value in a variable x and the highest in y, and for each pair of values,…
-
0
votes1
answer45
viewsLOWEST VALUE OF EACH MATRIX ROW
I need to find the lowest value of each matrix row. The values appear missing or the most (much more). What I have so far: #include <stdio.h> #include <stdlib.h> int main() { float…
-
0
votes0
answers26
viewsSegmentation Fault in ! (Isalpha(string)) (C)
My program is returning Segmentation fault when I enter a value that is not alpha, rather than falling into loop do{ name = get_string("Digite seu nome -> "); } while(!(isalpha(name))); The…
casked 4 years, 2 months ago Alyxson Marques 19 -
0
votes0
answers28
viewswhat the expression means:
Can anyone tell me what this part of the code means? (sorry for the redundancy, had asked the same question in another post of mine and was not answered). I’m still a layperson at c and normally I…
-
0
votes0
answers57
viewsMean of matrix columns
The code is wrong to print the average and fill the second matrix. The code: #include <stdio.h> #include <stdlib.h> int main() { float matriz[3][6]; float SomaImp = 0, SomaDQ = 0, SomaPS…
-
0
votes2
answers28
viewsChar in function is not recognized in c
I am unable to make the variable char be comparable and validated, the IDE says that the variable 'a' was undeclared, some could help me please Do a function that receives the 3 notes of a student…
-
0
votes1
answer39
viewsUnknown terms pointer in C
The first output of the printf is coming out a strange number, I think %p would be the address of the pointer would not be, the result gave 0060FEFC? in the second output *p + 2 = i + 2 I understand…
-
0
votes1
answer37
viewsHow does the diagonal sum printf of a matrix
I’m having a hard time creating a printf that depends on the input. I want you to print depending on how many numbers you have diagonally in a matrix and display those numbers. EXAMPLE: You must…
-
0
votes1
answer32
viewsHow to create a function that deletes all spaces before and after the phrase starts in a string
My goal in this function is to have a void function that changes a string so as to cut all spaces before and after the sentence, for example: transform the string " I went shopping " in the string…
-
0
votes1
answer77
viewsBINGO game in C , Using matrix with 3 dimensions?
How can I generate some (detail: plural) random cards with numbers, but need to manipulate them as a three-dimensional matrix. Cartela[players] [n] [n] .. n = The dimension My program generates only…
-
0
votes1
answer97
viewsError when calculating tree height Trie in C
I need to implement a code that calculates the height of a tree Trie in the C language. To struct of knot is the following: struct trie_cel { char tipo; // 'I': interno / 'P': palavra struct…
-
0
votes2
answers63
viewsproblem with scanf
I’m starting in C... and it always happens that the compiler ignores the scanf... but I do not understand why. This program is giving this error and I am not able to solve, if you can help me, thank…
casked 4 years, 1 month ago Julia Valente 7 -
0
votes1
answer23
viewsFile handling - HELP
I’m trying to develop a code whose goal is to read an existing text file and ask the user for a carectere, then the program should return to the user how many times the typed carectere repeats in…
casked 4 years, 1 month ago user15263331 11 -
0
votes1
answer37
viewsData storage problem in the vector
I’m learning to program and I’m having a hard time finding the error of this program. The note array is storing the 6 notes (2 of each student), but only puts the last two in the array. The problem…
-
0
votes2
answers135
viewsPassing a struct as parameter
Good afternoon! Can anyone help me? I’m having doubts in this exercise... I’m not getting through parameter to struct for another function. NOTE: I am starting now... it is advisable to keep the…
-
0
votes0
answers36
viewsHelp with arithmetic expression using stack
Hello, good morning, everyone! I have a problem solving this exercise, and I don’t really know where to go. My program must have an input that is a mathematical expression and must have as output S…
-
0
votes1
answer48
viewsI’m having a problem running a repeat on C
Description of the issue: "Implement the function below that takes a string and compresses it into a single character, any set of consecutive repeated characters." function: char *strpack(char *s)…
-
0
votes1
answer38
viewsWhat is wrong with my program for not giving the output of the structure object?
#include <stdio.h> #include <stdlib.h> #include <locale.h> #include <string.h> #define MAX 30 #define N_DISCIPLINAS 5 #define N_CHARDISCIPLINAS 30 /* run this program using…
-
0
votes1
answer31
viewsProblem printing code involving strings (c language)
#include <stdio.h> #define DIAS 7 typedef struct { char nome[51]; int idade; int refrigerante[7]; }Paciente; int main() { Paciente habitos; //Lendo os dados do paciente…
-
0
votes2
answers63
viewsError in printing C numbers
The error is that the printing of the numbers is appearing duplicated. Enunciation: The error message: The code: #include <stdio.h> #include <stdlib.h> int maiorValor(int *array[], int…
-
0
votes0
answers36
viewsHow to import a C library to a code in Assembly
I am trying to convert to Assembly a C code that uses the function getch() which is imported from the conio.h. library The problem is that when I try to run the Assembly program there is an error…
-
0
votes1
answer43
viewsPrinting the records of a file
I am making a program in c, which will read the records of a file and pass the name contained in the records to a double-chained list where they will be sorted alphabetically, and then with the help…
-
0
votes0
answers36
viewsValidation of strings in C
Good afternoon, I am learning C in college, and the following challenge has been proposed: A seller needs an algorithm that calculates the total price due for a customer. The algorithm must receive…
-
0
votes0
answers36
viewsola quero fazer um programa, em c, que devolve o minimo multiplo comum entre dois numeros
This is the code I have but it’s not returning anything. what will be wrong? #include <stdio.h> #define nao 0 #define ok 1 int main(){ int x,y,contador1=1, contador2=1,maior,menor,…
casked 4 years, 1 month ago user227365 1 -
0
votes1
answer94
viewsC - How to remove a word from a String
So, I have to remove a word from a String, already add with this code: printf("Digite o nome: \n"); scanf("%s", &temporaryVector); getchar(); lettersName = strlen(temporaryVector);…
-
0
votes0
answers25
viewsError debugging C code in vscode (with WSL)
Hello, I am having a problem debugging a code written in C, I am using Visual Studio Code (integrated to WSL), the problem occurs when calling Strtok function, if run without debug, the code runs…
-
0
votes1
answer104
viewsWhy does my running function only return "0"?
I’m doing a function that gets a string (char str[10]) and she has to return 1 if to string contain the word "wing" and otherwise return 0. To make it easier to understand what I tried to do, I’ll…
-
0
votes1
answer371
viewsHow to simulate Stack with chained list in C?
I’m trying to create a program that checks a certain sequence and returns whether it is well formed or poorly formed. I’d like to make the chained list behave like a pile, but I’m having trouble…
-
0
votes0
answers20
viewsMain() function; inside an external function in an external file
I would like to know if there is a possibility to include/call/return the function int main(){ within a case(x){ in an external file, to form a loop. I am developing an old game, and I am creating…
casked 4 years ago user191477 -
0
votes0
answers96
viewsError: subscripted value is neither array nor Pointer nor vector
What am I doing wrong in this code of mine to be making this mistake? Statement: Given the Matrix A = {{10, 30, 50}, {5, 15, 25}, {2, 5, 9}} and the Matrix B= {{5, 35, 70}, {1, 25, 30}, {1, 4, 7}},…
-
0
votes2
answers91
viewsfree() does not work in Dynamic Stack code
The dynamic stack works normally, but when I try to use the free() method to de-locate the memory of the removed elements and reboot the structure, the compiler does not return as expected.…
-
0
votes0
answers48
viewsI wanted to know how to pass an array as a parameter where the user will type the order
The code I had made is here. I set the max 5. Yeah, it’s the max of the exercise. #include<stdio.h> #include <stdlib.h> #define MAX 5 void exibir(int num, int jogo[][MAX]) { int i, j;…
-
0
votes1
answer62
viewsCode error for letter detection
I’m working on a code for letter detection using a function, for a classroom exercise. The idea is that when I type a letter the function detects if it is: maiscula = 1 minuscule = 0 something else…
-
0
votes0
answers42
viewsHow to make functions available in the "Python/C API"?
hello I am developing a python module and I have the following problem. When the module is compiled, only one function is available (fun1). how do I get fun2 stay available too? #define…
-
0
votes1
answer85
viewsC language - Error when using loop scanf to obtain integer and string type data
At first I was trying to make a binary tree that receives values of the intiro and string type (name and surname). But I’ll just put a bug to fix first. #include<stdio.h>…
-
0
votes1
answer58
viewsDo-while with char in C
EX. Create a program that reads sales values (old and new) of a product. The program must calculate the percentage increase of the product. The program ends only when the user informs the letter "N"…
-
0
votes2
answers77
viewsMemory allocation with malloc()
Doubt 1: The pont should reserve a memory block for 1 integer which was requested on malloc(), but he reserves 32 bytes or a memory block for 8 integers. 'Cause he does it? Doubt 2: If I make one…
-
0
votes1
answer39
viewsWrite class data in file . dat, and at each use check if the information exists
Good night, you guys. I’m writing a code for a university project. However, I’m having trouble manipulating the file in C++. I created a class called Stok and the amount of objects to be created are…
-
0
votes1
answer45
viewsPrinting vector memory garbage
How do I make a program not print vector trash? For example, I created 2 vectors at the beginning of my program with 5 elements each. If the user type numbers above 10 stores in v1 if it is larger…
-
0
votes0
answers10
viewsSegmentation failure C
I need help with this college job. My matrix cannot pass values above 1000 always from the segmentation error in the program. I have tried gdb but only returned it Program Received Signal SIGSEGV,…
-
0
votes1
answer24
viewsTrash value in a C array
I am making a program whose function is to import the values of a file . dat and put them inside a vector. For this, I made the following code: void Import_vec(int tamanho,const char caminho[],float…
-
0
votes0
answers34
viewscode::Locks not copying Ubuntu 20.04.2?
I use Ubuntu 20.04.2 and have always used Visual Studio Code to program. However, in the c language, I need to use the <Allegro library. h>, and then I need to use the code::Blocks. However, I…
-
0
votes0
answers15
viewsConflict between counting words from a file and other functions
I need to make a progress as described in the image. I was able to do all the steps, but I couldn’t get the word count to run along with the other processes. I followed the code: #include…