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
answer439
viewsPalindromic numbers in C
I need to create an algorithm that checks whether a number is palindromic or not. I decided to do this algorithm using a number as a string, but the program always returns that the numbers are not…
casked 4 years, 9 months ago matheusramos43 1 -
0
votes1
answer150
viewsHow to assign the return of Strtok to an array of strings?
Guys, I was testing the function strtok only it is giving this problem of "Segmentation failure (recorded core image)". Before I tried to do strPtr [i] = strtok (str1, str2); but I made that…
casked 7 years, 3 months ago Thiago Rizzi 3 -
0
votes0
answers21
viewsIs it possible to create programs with a graphical interface using C?
If you have how to create graphical interfaces in a program written in C, how should I proceed? I’m learning the C language, and I don’t have much knowledge of it. From now on, thank you.…
-
0
votes1
answer867
viewsCorrect answer but Uri does not accept
I’m starting to study pointer and decided to change my codes to use pointers, only I tried to send this solution to Uri and it gave a message - In Queue -,I don’t know where the bug is,. question…
casked 7 years, 3 months ago rafael marques 939 -
0
votes3
answers98
viewsError returning lower value
I’m trying to return the lowest value using the va_args, which supports several arguments, but it always returns the same number: -13227; #include <stdio.h> #include <limits.h> #include…
-
0
votes1
answer79
viewsI’m not managing to sort the notes with the use of struct
I wanted to sort the grades of the students, only I’m not able to do because at the time of receiving the grades I’m using the index j, I think that’s the problem only I don’t know how to solve.…
-
0
votes1
answer1550
viewsAdd row and column values and store in vector
Good afternoon, I am making an algorithm in which I need to store the total sums of each row and each column in different vectors. For example: vector A of 5 positions receives the sum total of 5…
-
0
votes1
answer95
viewsHow to print string struct in c?
When time print strings of a struct the program compiles and returns 0 but the values of the strings are not expected. Follow the code: #include <stdio.h> #include <stdlib.h> #include…
-
0
votes1
answer211
viewsCast in void pointer
The code below was working as expected, but changed the type of info in the structure Retangulo* for void* and tried to cast anyway but I continue with the following mistake: t.c: In function…
-
0
votes1
answer2059
viewsMeaning of the expression n %= 100
I have studied C and came across a very difficult problem that after a lot of trying, I gave up and went to look for an algorithm ready on the internet to study on it, but the expression n %= 100 I…
casked 7 years, 3 months ago Yan Sardinha 3 -
0
votes1
answer1119
viewsHow to check if the matrix is symmetrical?
I’m doing a college activity where you ask to check whether the matrix typed by the user is symmetric or not. Here is my code: #define TAMANHO 4 #include <stdio.h> #include <stdlib.h>…
-
0
votes1
answer1487
viewsChained list in C - Reversing nodes recursively
I’m following the notes of Algorithm Projects by Professor Paulo Feofiloff, and I’m having a hard time solving a question from the Chained Lists, transcript to follow: Exercises 5 Write a function…
-
0
votes1
answer912
viewsSegmentation fault (core dumped) when accessing String
I built the code below to separate only the last characters of a link (the last 11 to be exact). Until then everything works well, calculations are done normally, values also match. The problem is…
-
0
votes1
answer223
viewsC program that reads a text file and prints the lines in reverse order
I wonder why when running the script below, the lines appear spaced, except for the first line. Input Linha1 Linha2 Linha3 Linha4 Expected output Produtos: - Linha3 - Linha4 - Linha2 - Linha1 Output…
-
0
votes2
answers1247
viewsHow to check if one or more string has uppercase/lowercase initial character (C Language)
#include <stdio.h> char leitura(const char *str){ int i, resultado; for(i = 0; str[i] != '\0'; i++){ if(str[0] >= 'A' && str[0] <= 'Z' &&…
casked 4 years, 8 months ago Ruben Fontes 27 -
0
votes1
answer42
viewsHow do I link in gcc to a C library created by min?
I created a simple library in the C language, example. h and example. c, and includes it in a third code called (code. c). Only when compiling this third code: gcc code. c -o code.out Gave Undefined…
-
0
votes1
answer60
viewsProblems with struch and functions in c
#define FICH "Dados.Dat" /* Ficheiro com os Dados */ #define DIM 30 FILE *fp; /* Variavel Global pois e' util ao longo do prog. */ int cont = 0; typedef struct { char Nome[DIM+1]; char Tipo[DIM+1];…
-
0
votes2
answers55
viewsResume part of a string in function Return
I’m trying to find a string, and then scroll through some characters to get the desired information. I can do this, however, instead of presenting on screen I would like to assign the other…
casked 4 years, 7 months ago Dennis Piassa 1 -
0
votes1
answer367
viewsConcatenate strings in Arduin
How can I concatenate two or more strings using the language C with Arduino. I’m following several examples I’ve found around, but it always makes a mistake. "Conversion from 'unsigned char' to…
-
0
votes1
answer70
viewsGraphs with noise in the Adian in the plotter
Implement code that simulates the speed of a car as more noise signal, with 50 elements. The speed value increases linear mode by 0-50 km/h. The noise amplitude is 1 km/h. Values are sent to the…
-
0
votes0
answers227
viewsIndefinite reference error - Allegro 5
I installed the lib Allegro 5 with the following script : cd ~/Documentos sudo apt install -y git build-essential subversion cmake xorg-dev libgl1-mesa-dev libglu-dev install libpng-dev libz-dev…
-
0
votes1
answer62
viewsalgorithm to read age years, months, and years and convert the value to age only in days
#include <iostream> using namespace std; int main() { int idade; int anos; int meses; int dias; cin >> anos >> meses >> dias; meses= anos*12; dias= meses*30; cout <<…
-
0
votes1
answer37
viewsWhat is the difference between these string manipulations in C
Good morning! I’m learning C and I had a question about using strings, I wanted to know if there is difference to use this form: char palavra[255]; printf("Digite uma palavra: "); setbuf(stdin, 0);…
-
0
votes1
answer509
viewsHow to save value of a function that returns a char pointer in a string array
I would like to know how I can store the return of the function below, which generates a random string, in a vector of strings with 100 of these words generated by the function, to then make a sort…
casked 7 years, 3 months ago Caio Teixeira 61 -
0
votes1
answer48
viewsHow do I make the code read a new value if the condition is not met? - C
The code is this, it’s in C #include <stdio.h> int main(void){ int i; printf("digite um inteiro"); scanf("%d",&i); while(i>=1){ printf("%d\n",i); i=i-1; } } But I want you to enter an…
-
0
votes4
answers528
viewsError Segmentation Fault (Dumped Core) Binary Tree Search
I am doing a job that performs a key search (an int value) in a binary tree populated from a file txt. The archive txt has in each row the following record: a key (int), a date1 (long int) and a…
casked 7 years, 3 months ago Caio Teixeira 61 -
0
votes1
answer73
viewsWhy is the result of this operation resulting in an integer and not a "float"?
Because the result of the algorithm below is 1, and it should be 1.83? #include <stdio.h> int main() { float y; y = 1 + (1 / 2) + (1/3); printf("o resultado é %f" , y); return 0; }…
casked 4 years, 6 months ago Jordan Lordano 1 -
0
votes2
answers679
viewsStrings and Arrays, problems getting the right result
The goal of the program is to show information on one option and a 10 question survey on another option. Each discipline has 10 questions, and each discipline is done in a subprogram. the problem is…
-
0
votes2
answers42
viewsWhy not print the contact variable[0]->a?
Pointers still confuse me mostly in situations like this. The idea is simple. I’m trying to create a pointer vector like struct. But I must be using some misconception of pointers because the…
-
0
votes2
answers148
viewsTest equal to the question but is giving error
I decided that 2018 would learn to program, and I’m studying on my own, and by researching I found this judge named Uri, I’m having a hard time finding the error that is in my code, I did all the…
-
0
votes2
answers99
viewsProblem to remove space after line break
#include <stdio.h> int main (){ int x,y,i; scanf("%d",&x); scanf("%d",&y); if ((x<y)&&(x>1)&&(x<20)&&(y<10000)){ for (i=1;i<=x;i++){ printf("%d…
-
0
votes2
answers2358
viewsShow only the last word of a string
The purpose of the program is to read a string, ex: read - Jose Da Silva print - Silva I mean, always print the last word of string. My logic was to read the string back to front, and upon finding…
-
0
votes1
answer50
viewsDifficulties in making the G2 library work in C code
I have this code in which I get the following errors in the terminal, and the goal is to be shown with the G2 library: codigocanvas.c: In function ‘world_canvas_new’: codigocanvas.c:22:33: error:…
casked 7 years, 2 months ago André Rosa 1 -
0
votes1
answer295
viewsWhy is the C language considered to be a medium-level language?
The C programming language is considered a mid-level language. Why?
-
0
votes2
answers448
viewsAlgorithm problem over percentage
I had to do this algorithm : In 2010, a small Brazilian city has 20,000 inhabitants. The forecast of IBGE is that this city grows at a rate of 5% per year. Knowing of this, make an algorithm that…
-
0
votes1
answer244
viewsCipher of César, Error in the displacement of letters
I am trying to make a program that, the user will enter a name and will be asked how many positions the user wants to shift to the right. However, I had a problem. If I type the letter A and move to…
casked 7 years, 2 months ago rafael marques 939 -
0
votes2
answers121
viewsChained lists
I’m tending to create a program that as I enter with the values, it adds at the beginning of the chained list, so I saw it holding the values just right, but when printing it does not print, as if…
casked 7 years, 2 months ago Guilherme Garcia 5 -
0
votes0
answers16
viewsWhat’s the difference between void and nothing in the parameter?
What’s the difference between: #include <stdio.h> int main(){ printf("hello world\n") return 0; } and #include <stdio.h> int main(void){ printf("hello world\n") return 0; } It’s just…
-
0
votes1
answer90
viewsDoubt in the search for sub-string, inside a string
I did everything the question asked only that I’m taking 70% error. Question link My code #include <stdio.h> #include <string.h> #include <ctype.h> int main(int argc, char** argv)…
-
0
votes2
answers1600
viewsVector size in C
I am new to the C language and am getting problems to determine the size of vectors of the struct type. Example. I have a category type structure with three types of variables 1 int and 2 char.…
-
0
votes0
answers98
viewsC Matrix Printing Error
I’m trying to fill a matrix recursively to get how many vector values are equal, but it’s not working and I don’t know where the problem is. The matrix is generated by comparing 2 strings If the…
-
0
votes0
answers354
viewsvariable-sized Object may not be initialized
I’m having an error when I ask on the command line the values of WORLD X and WORLD Y error: variable-sized Object may not be initialized AGENT *grid[WORLD_X][WORLD_Y] = { NULL }; /* Verificar se…
-
0
votes1
answer2186
viewsChained List (insert at end)
I’m trying to make a linked list with insertion at the end of it, but at the time of writing the error and I don’t know what the problem is. #include <stdio.h> #include <stdlib.h> struct…
casked 7 years, 2 months ago Guilherme Garcia 5 -
0
votes0
answers18
viewsC# - How to make the program run something in certain days after execution?
I have a project that to start the . exe requests the registration of a company, but, need to renew the license in order to continue using, in case, how do I perform some action asking the customer…
-
0
votes1
answer85
viewsDoes anyone know why you made a mistake?
when I try to enter any character value the Skip program in the option and I don’t even get a chance to write anyone knows why? #include <stdlib.h> #include <stdio.h> #include…
-
0
votes2
answers66
viewsPrice calculation algorithm does not display the result correctly
I’m trying to make an algorithm to calculate what should be paid for a product, considering the normal price tag and the choice of payment condition, but it can not calculate, is displaying the…
-
0
votes1
answer114
viewsHow to create a pointer to store the address of a binary tree root and then use this address to call the root?
Iai galera, I have a problem in my code seemingly simple to solve, but I still get confused with pointers. The code is to insert each digit and operator of an entire parent expression into a binary…
-
0
votes1
answer42
viewsstring in C returning symbols instead of characters
I have this simple code in C language that gets an input value and returns the value on the screen. Instead of showing the string on the screen, it shows symbols like bars. When I do the procedure…
-
0
votes0
answers154
viewsSearch a C. csv file
Hello! I’m new to programming, and for a college job, I have to create a project where I have to use .csv. files.The program itself compiles, but I know I have an error in an if function, and I…
-
0
votes1
answer288
viewsPass values by reference C
I have to make a program with options menu that allows me to read a student’s information, write their name and phone after entering their student number, and determine how many students are older…