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
answer3593
viewsHow to compare a string of an array in C?
I have the following variables : char nome[10][8]; int i; --> Sendo esta para o loop I ask the user to enter 5 names and then I read the variable : printf("Entre 5 nomes : \n"); for(i=0; i< 5…
-
1
votes1
answer208
viewsConnecting led with Arduino using strings
Perform code that causes the D1 LED to be erased when it is sent from PC to Arduino an odd decimal numeric digit between {1,3,5,7,9} and accessed if the sent digit is even between {0,2,4,6,8}. How…
-
1
votes2
answers51
viewsCan anyone explain to me what this code does line by line?
void primeiro(int a) { a *= 2; printf("%d", a); } void segundo(int *u) { int x = 1; x = x + *u; primeiro(x); *u = x++; } int main() { int x = 5; segundo(&x); printf(":%d\n", x); }…
-
1
votes1
answer2799
viewsMakefile returning "Missing Separator" error
I am trying to run a Makefile that Compile programs in 'C'. TARGET=client server CC= gcc CFLAGS= -Wall -Wextra -g LDFLAGS = -lm -pthread -lncurses DEPS = util.h normal: $(TARGET) client: client.c…
-
1
votes1
answer825
viewsEvaluation activity hours per minutes
Question (2): Make a program that receives an hour formed per hour and minutes (a real number), calculate and show the time typed only in minutes. Consider that: for four and a half (4:30), type…
-
1
votes1
answer1028
viewsTransforming a Single List into a Double Chained List
For a college job, I need to get a C function to receive a Single List and return a Double Chained List with the even values of the Single List that was passed. My attempt is this, but only displays…
-
1
votes1
answer100
viewsError trying to grab data from a . txt file and move to a C queue?
I can open and go through the entire file the error happens when I try to point to the beginning or end of the queue, someone tell me if the pointers are correct typedef struct lista { int info;…
-
1
votes1
answer270
viewsApply color palette to raw image
I have an image at gray levels and I want an algorithm to apply a color palette to it. Does anyone have a reference of an algorithm technique used or anything like that? I’m not experienced with…
-
1
votes0
answers28
viewsFunction that returns more than one variable in c
I need to do a function that takes 3 floats and returns the average, the largest number among the 3 and the difference between the average and the largest. I tried to make the return by a pointer…
-
1
votes1
answer730
viewsUse Import or Include in C/C++?
#import <stdio.h> or #include <stdio.h> What is the correct way to use? I’ve been watching videos on Youtube for a while.…
-
1
votes3
answers116
viewsWhy is it not possible to assign a string vector after being declared a character?
char vetor[10]; vetor = 10 /*ERROR*/ Why does this happen? It has to do with vectors being composed?
-
1
votes1
answer100
viewsHow to apply "goto" to quicksort? (c, c++)
I’m doing a job for my college where I ask for a quicksort algorithm to be done in C, using "goto" as much as I can. In the code below I applied the "goto" as far as my knowledge allows, but I would…
-
1
votes1
answer64
viewsModify >= 2D array using pointers
I would like to modify my matrix ( multiplying by 2 each of its elements) using pointers, but I don’t know why my code isn’t working... #include<stdio.h> void changematrix(int **mm,int row,…
-
1
votes1
answer87
viewsCode error - Brazilian Computer Olympiad, C
Hi, I’m trying to solve this computer Olympics problem: http://olimpiada.ic.unicamp.br/passadas/pdf/provas/ProvaOBI2002.pdf and here’s the code I’m developing #include <stdio.h> int backtrack(…
casked 7 years, 7 months ago Guilherme Atihe de Oliveira 11 -
1
votes0
answers65
viewsHow to change stdout back to default?
In case I change the stdin and stdout for some . specific txt, however after changing do not know how to make it return to the normal stdout(in case the prompt), I change through the freopen as in…
-
1
votes3
answers524
viewsinclude library in C is required?
I came across the following situation: Ubuntu 16.01 gcc --version gcc (GCC) 6.3.0 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions.…
-
1
votes3
answers13060
viewsHow to add all the numbers in the sequence in while?
How to add 1 to 64 in while? I wanted to add up 1+2+3+4+...+64 print the sum value when arriving at the end. What I’ve tried so far: #include <stdlib.h> #include <stdio.h> int main(void)…
-
1
votes1
answer236
viewsTraverse an array using malloc
In the course of some questions here in the SO I saw this example and I was left with doubts. #include<stdio.h> #include<stdlib.h> #include<conio.h> void main() { clrscr(); int…
-
1
votes2
answers2484
viewsHow to store contacts from the agenda I created in an array array and list them? C
I’m trying to develop an agenda in C. I would like to know how to store contacts from the agenda I created in an array and list them? I’m also racking my brain when it comes to listing a phone…
-
1
votes1
answer463
viewsHow to remove all nodes from a circular list?
I’m having a hard time getting the logic of how to remove all nodes from a circular list, if someone could give a brief explanation of concept and / or point out the errors in the code I’ve already…
-
1
votes1
answer5263
viewsString chained list (character array) in C
I’m doing a job for college, and it’s basically about hash table. At work, I have to do a Hash table of a n strings, for example. Instead of making an array of characters (in this case, an array of…
-
1
votes0
answers49
viewsHow to check a CRC
I get 9 bytes per serial where the last two are CRC-16, I need to check this CRC to know if I received the block correctly. buffer[0] = 0x2E; buffer[1] = 0x83; buffer[2] = 0x82; buffer[3] = 0x00;…
-
1
votes1
answer234
viewsDynamically creating lists and saving their addresses (top of list)
Hi, I’m doing a college paper on Hash table and I’m having some difficulties. I will try not to complicate too much (to tell you the truth, the execution of my code helps me to understand what I…
-
1
votes1
answer62
viewsWhat’s wrong with my dynamic stack?
I’m trying to make a dynamic stack, and for some reason there’s something wrong with the function init. You’re making the following mistake: Warning: Conflicting types for 'init' #include…
-
1
votes2
answers608
viewsCan anyone help me with this?
5) Make a program that receives the basic salary of an employee, calculate and show your salary to receive, knowing that the employee has bonus of R $ 50 and pays tax 10% #include <stdio.h>…
-
1
votes2
answers806
viewsWhat is the usefulness of auto keyword in C?
To keyword auto, defined by the language C, is a keyword old and seemingly useless in the language. I know that in C its function is to define that it should be stored in stack as a local variable…
-
1
votes1
answer93
viewsHow do the main function inputs work in C?
I’ve always used the main function as follows, creating other functions: int main() { . . . return 0; } How the inputs to the main function work? int main(int argc, char **argv){ We have a variable…
-
1
votes1
answer92
viewsMake a drawing as user input
The exercise asks the program to receive an integer n and print a height drawing 2*n as follows: \ * / \ *** / \*****/ \***/ \*/ /*\ /***\ /*****\ / *** \ / * \ I did the following until the moment:…
-
1
votes1
answer1288
viewsI want to make a decimal to binary converter without using itoa() or vectors in C
My code works up to a point. When I provide values above 1023 for num, the program goes wrong, below 1023 the program works perfectly. Someone knows what can be? #include <stdio.h> #include…
-
1
votes1
answer66
viewsProgram without SIGINT signal interruption
I’m trying to write a program that stays on an infinite loop, and can’t be stopped by the SIGINT( C signal on the keyboard). What I have so far is the following code: void sigint(); int main() { int…
-
1
votes1
answer54
viewsMáquina Dobradora
I’m studying for a programming challenge at College and my teacher gave some programming exercises to train. It was proposed the folding machine, but I am not able to develop the input process, in…
-
1
votes2
answers1005
viewsHow to get all the digits of a variable in C?
I have to do a function that tests divisibility by 3, return true if divisible by 3. Otherwise return false. Following the rule : A number is divisible by 3 when the sum of its digits is divisible…
-
1
votes1
answer591
viewsDoubt in code in C!
Personal someone could help me in this matter of my exercise list: Make a program that receives a real number, find and show: a) the whole of that number; b) the fractional part of that paragraph;…
-
1
votes1
answer2117
viewsHow to correctly call a function through another function in C?
I have the following duties : int testarDivisibilidade(int dividendo, int divisor); int divisibilidade3(int num); And the following variables: : int dividendo; int divisor; With the function…
-
1
votes2
answers2428
viewsHow to use getche() with do-while in C?
I have the following variable : #include <stdio.h> #include <stdlib.h> #include <conio.h> char op; And I’m asking the user to enter a character : printf("\nDeseja realizar novo…
-
1
votes3
answers624
viewsDoubt about recursiveness in C
I’m learning about recursion, using the C language, and I have to do the following exercise: Design a recursive function that takes an integer n and compute the sum of the digits of n. For example:…
-
1
votes1
answer27
viewsSwitch command running even without being called - C
I’m solving an exercise in logic and I can’t understand the error: #include <stdio.h> #include <stdlib.h> int main(){ int TotalVinhos=0, t=0, b=0, r=0, fim = 0; //float Porc; char tipo;…
-
1
votes1
answer1675
viewsHow to read data from an excel table in C?
I know how to read data and write to files .txt code C through functions fscanf(), fprintf() etc. But now I would like to know if there are functions or libraries in C that allow me to process data…
-
1
votes4
answers25657
viewsHow to convert a char to an integer?
Convert a string for an integer with the function atoi() it’s easy, it’s not even? However, when I use the function atoi() to convert a character to an entire program that is running time simply…
-
1
votes1
answer116
viewsHow to use Lock Functions (Lock Routines) from Openmp?
I need to create 5 easy-to-understand algorithms for each of the blocking functions below in C or C++ to be able to exemplify how each one works and present to my office staff.…
-
1
votes1
answer279
viewsError: "error: array type 'int [sizeExcedent]' is not Assignable"
When trying to compile the program I get the following message: error: array type 'int [sizeExcedent]' is not Assignable uppercase = vector II; ~~~~~~~~ ^ error: array type 'int [sizeExcedent]' is…
-
1
votes1
answer738
viewsComparison of char type variables
I’m developing a program that needs to read a variable in char and compare the same with another char. However, when performing the comparisons using the function strcmp(typed_pass, correct_pass),…
-
1
votes1
answer179
viewsMalloc does not work in C code
While trying to compile the code I get the following error messages: #include <stdio.h> #include <stdlib.h> #define OK 0 void preencherVetor(int* vetor[], int tamanho) { int indice; for…
-
1
votes2
answers874
viewsWhat does while(x-) mean in C language?
I came across this code and didn’t understand the tie while(a--), what it means? int main(){ char pisca[10], a = 3; short numero; while(a--){ numero = 0; while(1){ scanf("%s caw", pisca);…
-
1
votes1
answer5093
viewsHow to make dynamic string allocation
Well I wanted to dynamically allocate several names in c, I already know how to do only normal but want as I show here in the code #include <stdio.h> #include <stdlib.h> int main(int…
casked 6 years, 7 months ago rafael marques 939 -
1
votes2
answers668
viewsAssign values to a variable
I have the following program: #include <stdio.h> int a,b; int main(int argc,char *argv[]){ int c; printf("%d",a+b); printf("%d",c); return 0; } How do I pass a value to the global or local…
-
1
votes2
answers6045
viewsHow can I invert a simple chained list without using a previous pointer
I have to solve a data structure fiction problem that consists of reversing a chained list but how can I invert a list if I don’t have its elements (Less of course p-start and p->end )follows the…
-
1
votes0
answers428
viewsCheck whether the tree is AVL or not
Hello, I need to make the function verificaAVL (which is called in case 8, line 364), check whether the tree is AVL or not, that is, if the result of its nodes is -1,0 or 1, it just writes on the…
-
1
votes1
answer408
views -
1
votes1
answer2803
viewsCompare a char vector?
Good staff I have the following doubt why I can’t compare two char vectors using relational operators ? I know that vectors are a composite type and that the characters are in a static area I’m sure…