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
votes0
answers24
viewsCompiler does not detect Signal functions
Good night! I study computer engineering and have recently programmed in C due to a project... This same project uses two libraries (#include Signal.h, #include Signal.h). We use a server where all…
-
0
votes3
answers633
viewsC: Delta, X1 and x2 result always giving 0.000000
I’m learning C in college, and I’m stuck with this algorithm. I can’t find the error. It can differentiate whether delta is greater or less than zero, but always prints delta, X1 and x2 as 0.000000…
-
0
votes1
answer663
viewsPassing pointer pointer by reference
I’m making a program where I need to dynamically allocate two matrices, so I thought I’d make this allocation into a function. I tried to do it this way, but it’s giving "Segmentation Failure".…
-
0
votes1
answer4296
viewsConcatenate String into C without using strcat() function
need a help, needed to solve this programming language exercise, would concatenate a string, in case STRING_B in STIRNG_A, without use of ready function, by pointer method. example: ENTRADAS…
-
0
votes1
answer41
viewsProblems accessing struct members
I have to do some functions with these structs, but since Agenda has a contact struct array and in each contact has another data struct, how do I access the fields? Do I have to work each struct…
-
0
votes2
answers109
viewsCalculation of T(n)
Could someone explain to me how to calculate the T(n) of this algorithm being n >= 0? I’ve seen videos and classes and I can’t understand how this calculation works. T(n) of an algorithm is how…
-
0
votes2
answers78
viewsDoubt about vector in C
Good evening, I have a doubt in the code I made below, my teacher requested that the values name, ra, n1,N2 be read and be displayed to the average of 40 students, I’m trying to put when I try to…
-
0
votes1
answer32
viewsRemoval of files in c
I am doing a job and arrived at a part of removing file that the user wants, but it reads and does not remove. to remove I should use extension (.txt)? if yes, how? void removeCliente() { char…
casked 6 years, 4 months ago Ariani Assunçao 1 -
0
votes1
answer132
viewsHow to allocate memory space?
Make a program to allocate memory space for 10 integers and ask the user to enter 10 values. Later, print your respective memory address and content. What I have to change in my program to make it…
-
0
votes1
answer84
viewsNeed pull-down resistor
I’m using the function attachInterrupt() in the Arduino Uno to recognize the end of a course of an actuator. Normally test is used with if(), but the actuator cycle is very fast and the recognition…
-
0
votes1
answer453
viewsRecursive function of Insert Nodes
Analyzing other problems, I realized the need to use pointers on certain tree functions. So I set the Insert function to : Arvore* insereNo (Arvore** A, int chave) The point is that later, when…
casked 7 years, 7 months ago Paulo Bomfim 17 -
0
votes0
answers305
views"Undefined Reference to" error in functions
I made a code that reads a file and creates a map based on the coordinates of that file, but all the functions of the code have the error "Undefined Reference to " Compiler shows following errors:…
-
0
votes1
answer146
viewsCompare date and time
In C I have the lib time. h to manipulate date and time, already in Arduino the class Datetime that implements some methods. I’m not finding, even if it is in the fingernail, how to compare date and…
-
0
votes1
answer698
viewsManipulation of values in input files c . txt code
This is what I need to do Create an algorithm where you calculate through various temperature inputs the percentage outside the variation stipulated as maximum and minimum having as out of +-3…
-
0
votes1
answer62
viewsMalloc in a string, based on the size of a FILE
int main(void) { FILE *p = fopen("matriz.txt","r+"); char *arquivo; arquivo=(char*)malloc(sizeof(p+1)*sizeof(char)); while (fgets(arquivo,sizeof(arquivo),p)) { printf(" %s",arquivo ); } }//END the…
-
0
votes2
answers112
viewsHelp fread C library function
Could someone tell me why this snippet of code just starts reading from the second element of the file? And how could I read all the records in the file? Code I’m trying to use to read a txt file…
-
0
votes0
answers88
viewsError "in such file or directory" - Eclipse
I am developing a software on a prototype board, which is the ARMST32 - F411RE, for this I created in the software Stm32cubemx the following model: But when generating the algorithm and trying to…
-
0
votes1
answer1589
viewsDouble chained list printing in reverse order
Good morning, this is my first post here at Stack Overflow. I was trying to get a double-chained list printed in reverse order. However, after going through this list in reverse, it produced the…
-
0
votes1
answer2436
viewsCopy list simply chained in C
Hey, guys, I need help copying a list just chained up backwards. For example, if the original list is 1->2->3->null, I need it to be 3->2->1->null. #include <stdio.h>…
-
0
votes1
answer189
viewsCheck if typed string is in email format
Guys, I need a little help to check if the email you typed ends with "@usp.br". Here’s the code I’ve tried: /* pega o tamanho total do email digitado */ int tamanho = strlen(email); /* a partir do…
-
0
votes1
answer406
viewsProblem removing the first node from the double-chained list
Good night, I am trying to solve a question that asked to remove students whose CR is less than 5. My biggest problem is to remove the first node (first student) from a doubly chained list when…
-
0
votes2
answers118
viewsmanipulation of some struct
I have a struct, how do I predefine data in this struct? example define life of struct 100? I’ve tried to dataplyer.vida = 100; struct dataplayer { int vida; int armadura; int arma; int level; };…
-
0
votes1
answer147
viewsInsert in list order in C
I have the following function: Nodo * insertOrder(Nodo *L,Nodo *nv){ //11,1,50,7,5 if(L==NULL){ return nv; } if(nv->id < L->id){ return (insertFirst(L, nv)); } int c=0; Nodo *aux2=L; Nodo…
-
0
votes1
answer43
viewsSimply Chained List Printing/Abstract Data Type - ADT
I’m having difficulty not implementing the void exibe_lst(Telem* lst) function, I can’t get the entered elements to be displayed due to a conversion I don’t know how to solve. Follow the TAD link.…
-
0
votes1
answer348
viewsC vector product with file input . dat
Be the code below, where the input vector.dat file, on each line, has 6 numbers where the first 3 are components of a vector "u" and the last 3 are components of a vector "v". The vector.dat output…
-
0
votes1
answer99
viewsCreating strings with special characters
I am making a clock simulator program. However, when printing the result, I am having errors. Here’s how I do it: float abc = 1:00 + 2:00 ; printf("horario: %f",abc); How do I then make and print a…
-
0
votes0
answers55
views -
0
votes1
answer122
viewsReference not set for "crypt" error in linkage
I am used the "crypt" function in that following code: #define _XOPEN_SOURCE #include <unistd.h> #include <stdio.h> int main(void) { char *key = "rdf"; char *salt = "50"; char *hash =…
-
0
votes0
answers111
viewsWorking with pennies in C
In the code below I can receive values in the pay fields without cents (example: 1,800), but if I put (1,800,20) has error. Detail I’m using setlocale(LC_ALL,"Portuguese"); . printf("\nAntepenúltimo…
-
0
votes0
answers57
viewsProgram enters unwanted looping - Arduino
The following code must, when pressing a button, execute the commands once. If the user holds the button pressed, the code should also be executed only once, as if it were just a pulse on the…
-
0
votes1
answer85
viewsCreate random character lines in Arduino
Good afternoon, I wanted to make Arduino digispark type a line with 8 random characters and jump to the other line doing the same thing, only I don’t know how to control the size for this...…
-
0
votes3
answers100
viewsCode in c to calculate hypotenuse with cosine and adjacent
This is the code I made to try to solve the following question, it’s not working, someone can help me? #include <stdio.h> #include <math.h> int main() { cos(a) float d, hip; printf("qual…
casked 6 years, 2 months ago Pedro Siqueira 19 -
0
votes2
answers1092
viewsSeparating small strings from a giant string
Hello. I have to do a function to read a huge string and then divide it into small strings for each field. Each field would be separated by ; example: BRUNNY;PR;MG;T;Câmara dos Deputados, Edifício…
-
0
votes1
answer62
viewsChange signature and parameters of some functions
I’m creating a program that reverses the non-vowel sequences of a word represented by a list simply chained, headless and without a sentinel. That is, each node in the list has a letter field. My…
-
0
votes1
answer43
viewsChained list returning empty outside function
I’m trying to read data from a file .obj and insert into a chained list, I have a function to read and within it I call the insert function. When I call the function of printing the list inside the…
-
0
votes1
answer836
viewsERROR: Static declaration of Follows non-static declaration
My code has the following error and I’m not seeing or understanding what it is. 80:6: error: Static declaration of 'print_menu' Follows non-static declaration void print_menu(){ 14:6: note: Previous…
casked 7 years, 7 months ago Gabriel Dantas 55 -
0
votes1
answer41
viewsI created a function to receive a structure, but it always returns 0, can anyone help me?
Structure: typedef struct entrada{ int M; long int Nmax; double a0, a1, a2, a3, a4, a5; double A, B, e1, e2; }valor; Function: double FuncaoDada(struct entrada valor, double x) { double resultado;…
-
0
votes1
answer82
viewsChained list prints beyond what is inserted
I have that function verticeobj* loadverticeObj(char *fname,verticeobj *vo){ FILE *fp; int read; float x, y, z; char ch; fp=fopen(fname,"r"); if (!fp) { printf("can't open file %s\n", fname);…
-
0
votes1
answer84
viewsGenerate all possible paths
In an exercise, I need to print, in a file, all the trajectory possibilities between a number N of cities, each city being represented by coordinates x and y and that the last city should be the…
-
0
votes1
answer214
viewsReallocate My Structure Size in C?
typedef struct tempNo { int valor; int coluna; struct tempNo* prox; } NO; typedef NO* PONT; typedef struct { PONT* A; int linhas; …
-
0
votes1
answer106
viewsTake an integer and a string and store in 2 vectors in C?
I am learning C and am locked in an exercise that asks to store the data as follows. Student’s Grade and Student’s Name on the same line, and then with a chosen index determine the student’s status,…
-
0
votes4
answers123
viewsIs there a smaller way to resolve the question below? and know if it is correct
Create an algorithm that contains an integer vector. Then, your algorithm should generate two more vectors. The first vector must store the numbers of the initial vector in ascending order and the…
-
0
votes0
answers99
viewsArduino -> Function/variable/library conflict
I’m doing a program on Arduino. I’m using the Freematics OBDII (UART) adapter. They’ve developed a specific library. There is a problem: trying to read a PID, which returns me 2 bytes with a value…
-
0
votes2
answers118
viewsIncorrect value in subtraction of binary numbers using strings
I made this code and it basically gets two numbers in binaries (no separation of spaces between bits), and Performa (at least in the values I tested) the subtraction correctly. I tried to prevent…
-
0
votes1
answer69
viewsResult of a command in a variable
When I run the following code it stores the output status of the command wc -l which has value 0 as it has been successfully executed. #include <stdio.h> #include <stdlib.h> int main() {…
-
0
votes1
answer1026
viewsPrinting binary tree graphically in C
Last week I was working on this code that prints binary tree graphically but I didn’t understand very well its way of using or if there is a bug because I type in the amount of nodes and the…
-
0
votes1
answer158
viewsHow to ignore comments on P3 ppm files?
In the ler_arquivo_ppm_p3(const char *filename) function how would you ignore comments (# comet) in ppm P3 files? #include <stdio.h> #include <stdlib.h> typedef struct PIXEL { int r, g,…
-
0
votes2
answers191
viewsdifference between vet[] and *vet
When I send a vector to the function, in the arguments.. what’s the difference between putting void funcao(int vet[]) and void funcao(int *vet)…
-
0
votes1
answer166
viewsUse of Enum within a Struct
Good evening. I have to do a program where I have to create several elements using the following: typedef enum {ATRIB, ADD, SUB, MUL, IF_I, PRINT, READ, GOTO_I, LABEL} OpKind; typedef enum {EMPTY,…
-
0
votes0
answers200
viewsError running program in C "No such file or directory"
I am trying to run a program in C, but an error occurs I take the following steps: gcc -c prog.c -o prog /.prog And it turns up: bash: /.prog: No such file or directory…