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
answer43
viewsI need to break a string that I receive and I need to divide it. This division will be given to each comma. I’m getting him to recognize the comma
What I’ve done so far is this: #include <stdio.h> #include <string.h> int cont = 0; int pos[6]; char buffer[107] =…
-
-1
votes1
answer48
viewsMy C code compiles but is not executed
The code is as follows:: #include <stdio.h> int main(void) { int qtdDeElementos; int vetor[qtdDeElementos]; printf("Informe a quantidade de elementos do vetor: "); scanf("%i",…
-
-1
votes2
answers48
viewsQuestion in reading and printing names with char
Eai guys. I’m trying to create a code that reads, stores and prints names up to 5 letters(Characters). I’m sure there must be a more agile way than the one I made, just below: OBS: I want to be able…
-
-1
votes1
answer42
viewsHow do I compare a string that is part of a txt file and another one typed by the user in C?
I’m a beginner in programming and I’m learning how to manipulate strings, but I’m still a little confused on some kkkkkk things. Finally, regarding the exercise, we have a txt file containing the…
casked 3 years, 4 months ago Ingrid Amorim 1 -
-1
votes1
answer23
views -
-1
votes1
answer47
viewsInvert string message in c
#include <stdio.h> #include <string.h> int main () { char palavra[256] = {0}; char mensagem [20][21] = {0}, mensagemInvertida [20] [21] = {0}; int numP = 0; int i = 0, j = 0; char erro =…
-
-1
votes1
answer38
viewsHow to read two vectors and place the values in a third vector and in ascending order?
the statement of the problem is as follows: Make a program that reads an integer value N. After that, read N integer values by placing them in an A vector of size N. Then read an integer value M.…
casked 3 years, 4 months ago JoaoHardline 11 -
-1
votes1
answer94
viewsHow do I know if my threads are actually running at the same time?
The doubt arose in a college job where we need to make use of threads in c. We have been asked to study the "libpthread" so we can get on with the job. The material I’m finding in my research does…
-
-1
votes1
answer41
viewsHow to assign positions to an array within a "while" loop?
Hello! I am very beginner in programming and am doing an exercise to create a program that converts decimal numbers -from 0 to 255 -, which the user types, to binaries. I can already convert…
-
-1
votes1
answer20
viewsAssign a float in main() to a struct inside another struct
I’m doing an exercise and I can’t understand what I’m missing in this final part. Basically I need to do a struct to register an employee, and within that struct use another struct with the value of…
-
-1
votes0
answers53
viewsProblem with pointer in Function C
I’m having second thoughts about the registration function. In the part where I inform dynamically through a counter the number already registered, when it arrives in the second iteration, the…
casked 3 years, 3 months ago Ramiro Arthur Bayer Martins 29 -
-1
votes1
answer52
viewsI want to know why the first gap of the is does not perform a second time
#include <stdio.h> #include <stdlib.h> struct carro { char marca[10]; char modelo[10]; int ano; char lplaca[3]; int nplaca; }; struct carro cad[2]; int main (void) { int i; for (i=0;…
casked 3 years, 3 months ago João Vitor Santos 11 -
-1
votes0
answers21
viewsProblem comparing a vector of a struct with a variable
I’m having trouble comparing a vector that’s from a struct with a variable, is always giving the retorno equal to -1. Code: void consultarpront() { int i,retorno=0,continua,ok=0,consulta[13];…
casked 3 years, 3 months ago Ryan Kologeski 1 -
-1
votes1
answer40
viewsHow to insert a Binary Search Tree in C
I’m not getting the insertion recursively and I don’t know what I’m doing wrong.. Precise follow the following prototypes: struct Arvore { int info; struct Arvore *esq, *dir; }; typedef struct…
casked 3 years, 3 months ago Carlos Loureiro 1 -
-1
votes2
answers44
viewsStore words in a "char" vector
I’m trying to make an algorithm that returns the region of the CPF that was informed, but I’m bumping into the character limit that a variable of the type char allows in C language. I tried to…
-
-1
votes0
answers29
viewsSudoku program
I have a sudoku program that checks everything is correct, if you have it shows "Sudoku Ok!" on the screen, if not it will show the row and column that is the error. But I have a question and I…
casked 3 years, 3 months ago Matheus Carvalho 1 -
-1
votes1
answer43
viewsReturn to menu in C
Hi guys I’m new in programming and I’m developing a program just to put into practice what I learned for now in 1 month and a half so don’t mind if there are many lines that could be simplified and…
-
-1
votes0
answers15
viewsMount a string with user-delimited size and can be parsed character by character
I need to keep several names (compounds) of different people, so that I can return to the user the first letters of each name, and the last name of each person. That’s what I’ve done so far:…
-
-1
votes1
answer18
viewsC - String comparison with strcmp does not work
Guys, I’m trying to compare a string entered by the user in a dynamic array of strings with a predefined string. In the DO-WHILE loop the repetition should end as the string the user enters for FIM,…
-
-1
votes0
answers18
viewsI don’t know how to pass the vector to main and manipulate it
Read a string with up to 100 characters and make a function that receives the string and returns how many words there are in the string. Create a second function to count how many letters there are…
-
-1
votes0
answers18
viewsthe sum of the odd numbers drawn in the array
Someone give me a hand on how to calculate the odd numbers drawn from that array at the end there #include <stdio.h> #include <stdlib.h> #include <time.h> const int T = 10; //…
-
-1
votes1
answer18
viewsAssemble an Array of at most 10 x 10, which the user chooses the order in a function, and then assemble the matrix in another function
Write a program that reads an array (maximum 10 x 10). The order matrix is chosen by the user. Next use a function to: a) Read integer values from matrix; b) Show matrix values; However, it is…
-
-2
votes4
answers167
viewsproblem with C code conversion
I’d like to turn that into code C I’ve done everything I’m only having the problem in part "If MEDIA >=6 And FALTAS <=10 So" mostly on the part of And I don’t know how I’m gonna separate the…
casked 10 years, 8 months ago matheus ferreira 357 -
-2
votes1
answer620
viewsFunction count comments and another program per C command line
I’m having trouble knowing how to develop a function that via command line will count and display the amount of commented lines of another program in . c, for example: Counter Programexample. c -c…
casked 10 years, 7 months ago phpricardo 765 -
-2
votes2
answers299
viewsSudoku does not print answers on screen
This code has no error, but the program does not solve the game (does not print the answers on the screen): #include<stdio.h> #include<stdlib.h> #include <time.h> #define N 9…
casked 10 years ago Leonardo V. De Gasperin 713 -
-2
votes1
answer677
viewsAlgorithm to generate a character diamond
I’m trying to make a C program to generate a diamond as exemplified in the image below: I couldn’t get an algorithm to generate the characters and spaces needed on each line. What a reasonable way…
-
-2
votes2
answers844
viewsHow to transform a mathematical expression into a C language
How can I turn it into C language?
-
-2
votes1
answer307
viewsC file explorer script
Good evening, everyone. I need to implement a C program that works as a.s file explorer system. The program should allow you to explore computer locations by ADVANCING and RETURNING directories and…
casked 9 years ago VitorLucasBR92 1 -
-2
votes1
answer41528
viewsCalculation of percentage in C
" Encode, Compile and run a C program that receives the the basic salary of an employee, calculate and show the salary to be received, knowing that this employee has a 5% bonus on the basic salary,…
-
-2
votes1
answer30
viewsError In Unity5 Code
I have two mistakes , I’m not able to fix…
-
-2
votes1
answer927
viewsMake a function that receives a matrix A(10,10) and returns a vector with the sum of each of the lines of A
I’m trying to solve this problem. #include <stdio.h> /* 5. Faça uma função que receba uma matriz A(10,10) e retorna um vetor com a soma de cada uma das linhas de A. */ int matriz[3][3]; void…
-
-2
votes1
answer2446
viewsFind strings within *.txt files in C
I’m a beginner and I’m dying to do a program and C++ that requires doing two functions. 1) Searching a *.txt file for a specific string; 2) Through some type of index indicate the position of this…
-
-2
votes1
answer208
viewsProgram.exe has stopped working
I’m doing a program that captures a person’s full name and reproduces it in this format: surname, surname without surname (EX:João Carlos Cunha -> Cunha, João Carlos. Amanda Batista ->…
-
-2
votes1
answer95
viewsstruct problem
good, I developed a parking lot management program, when people to show on the screen all the cars and their features the brand is printed next to the license plate and do not know why.Can help me?…
-
-2
votes3
answers797
viewsCount numbers 1 in binary number after decimal base conversion
In this program I need to count the number 1 present in the binary number after decimal base conversion. Follow the code: #include<stdio.h> #include<stdlib.h> #include<string.h>…
-
-2
votes1
answer76
viewsInsert end list function on
Guys I’m not getting to develop this function. bool inserir_fim (tipo_lista * p, tipo_lista * novo_no) { }
-
-2
votes1
answer317
viewsSplitting project into multiple headers causes error: Dereferencing Pointer to incomplete type
I was wondering how to divide a project into several files. I had created a project divided into 3 files first, one main. c (containing main function), a lib.c (implementing functions used in…
-
-2
votes2
answers69
viewsError in case procedure 3
I’m having problems in my case 3 of my C code, it should compare the two strings with the strcmp function filmeIgual=strcmp(filmePesquisa,v[x].nome); and if the result is zero, if(filmeIgual == 0),…
-
-2
votes1
answer134
viewsHow do I read and separate the save data separated by the period and comma and comma?
Good evening guys, I am making a program in c that has to read a file and save the data, and each line of the file represents the data of a client, how do I save the data by separating it by these…
casked 7 years, 5 months ago Stelio Spallanzani 53 -
-2
votes1
answer385
viewsGet all the text from a typed line
I am creating a C algorithm to train even and need to pick a text (large and with spaces) that the user type at the same prompt. I tried using scanf, gets and fgets and none is picking up what comes…
-
-2
votes1
answer196
viewsHow to recognize the type of data entered - C
I am making a program where the user can register, search and remove customers. To enter it type "insert [client name]" and a code is generated automatically. I have a problem in the search…
-
-2
votes2
answers136
viewsScan more than one string
In C I can scan more than one string as is done with integers? Type: scanf("%s %s", pal1, pal2);
-
-2
votes2
answers177
viewsNear and Far pointer error in C code
Code compilation error in C, with Near and Far pointers #include <stdio.h> void main(void) { char *titulo_near = "Bíblia do Programador C/C++, do Jamsa!"; char far *titulo_far = "Bíblia do…
-
-2
votes1
answer107
viewsProblem when displaying list
I’m using the static type list, and when I try to display it, it just shows the first student of registered. #include <stdio.h> #include <stdlib.h> #define MAX 12 typedef struct Alunos…
-
-2
votes1
answer157
viewsComparison of elements of a vector with "strcmp()"
In the following function I want to compare the elements of a array of 1000, but I can’t find a way to successfully compare them, even using strcmp(). void verifica_conta(int *ptr) { int i;…
-
-2
votes3
answers1916
viewsHow to replace vowels with @
I’m doing a college task that asks for a program where the user type the string [20] and I return to it the string reversed and with the vowels replaced by @s. How do I do it?
-
-2
votes1
answer104
viewsexecute grep command in C language and return result
void main() { char comando[2000]; char resultado[500] sprintf(comando, "grep '[0-9]{50}-' input.txt); resultado = system(comando); printf("%s\n",resultado); } I only need 1 match, and return the…
-
-2
votes1
answer26
viewsrenaming file with Posix c
I have a file called Tempfile.txt I made the following script in c to rename file receiving the file name to be renamed and the new name, but it is returning this error: Error renaming file: Bad…
-
-2
votes1
answer31
viewsC programming using Codeblocks from giving error in the programming below
#include <stdio.h> #include <stdlib.h> int main() { float num1 = 10; float num2 = 20; int resposta; num1 < num2 ? printf("Sim/n") : printf("Nao/n"); num1 < num2 ? resposta = 10 :…
casked 6 years, 8 months ago Pro.glauber 1 -
-2
votes2
answers5608
viewsCount how many times each character appears in a string (no function use)
I’m having the doubt in a matter of string exercises that I’m doing. The question is this below: Write a program that reads a string and prints how many times each character appears in this string…