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
answer51
viewsReading a sequence between 2 and a given value of x
Good afternoon, I would like to know, how can I create a vector that stores a sequence, that is, if I want the numbers between 2 and x and the user between x = 10, the values within the vector are…
casked 9 years, 7 months ago Gabriel Vinicius 339 -
1
votes1
answer93
viewsError when I try to call a function
I need to calculate the distance between two points, but when I call the function that does this (calculates the distance), it gives the error: "subscripted value is neither array nor Pointer…
casked 9 years, 11 months ago user3741052 87 -
1
votes1
answer5806
viewsDeleting specific line from a text file
I need to delete the last line of a text file. It files user coordinates for each line, but when the user requests a Ctrl + z, I need to delete the last line. How can I do that?…
-
1
votes1
answer5247
viewsRemove text file
I’m having trouble removing a C text file. Soon after using the fclose() function, I use remove() indicating the name of the text file, but the file is not deleted (the remove() function is not…
-
1
votes1
answer161
viewsFunction that returns pointer gives crash when trying to return pointer to main program
I have this function that retrieves a record from a binary file already filled with records - such records are structured as Node - and returns it to the program. Only in the return of "i" for the…
-
1
votes1
answer101
viewsHow can I add the result value to the previous value?
I’d like to know, res the value of the sequence and then print it? as for example, enter the value of N equal to 2 and achieve output value 2.5? #include <stdio.h> int main (void) { int N,i;…
casked 9 years, 7 months ago Gabriel Vinicius 339 -
1
votes2
answers5100
viewsHow to search in txt file?
How do I search a file .txt which contains for example a list of numbered names, type: 1 - João 2 - Maria ... I would inform the desired number and the return would be the name, or say that nothing…
-
1
votes1
answer82
viewsUnexpected result in C program
In that code: #include <stdio.h> #include <stdlib.h> int main() { int x, y = 10; //incrementa depois atribui y = ++x; printf("x = %d\n", x); printf("y = %d\n", y); system("pause");…
-
1
votes2
answers92
viewsWhy the result of this code in C of the 55?
I wanted to know why the result of this code of 55, I am reading in the book and did not understand, I compiled in codeblocks. #include <stdio.h> #include <stdlib.h> int main() { int i,…
-
1
votes2
answers137
viewsError in my C Program
When I type 0 it does not inform as the program should: "Incorrect input. Enter an integer value". #include <stdio.h> void LimpaBuffer(void) { int valorLido; /* valorLido deve ser int */ do {…
casked 9 years, 11 months ago user10000000000000000000000000 13 -
1
votes1
answer120
viewsHow to resume all students with a common name
I’m developing a program that has to run a school canteen and on the menu I have an option to search student by number and another to search all students who have a first name in common. Here’s my…
-
1
votes3
answers264
viewsPointer return error in function
Guys, I’m making the following mistake: incompatible types when assigning to type 'char [30] ' from type 'char *' the code is as follows:: int main() { char *resultado[30]; float valor = 12735.98;…
-
1
votes2
answers93
viewsIs it possible to change my server code without having to compile?
Well I was thinking of something, I have a program that is hosted on linux and through an executable, my clients have access, every modification I do in the server code I have to compile again to…
casked 9 years, 6 months ago carolzinha 171 -
1
votes3
answers252
viewsArrays not started in C
How do I know how much size I have to put to scroll through an uninitiated array []? For example this one with char[]. #include <stdio.h> #include <stdlib.h> int main() { char texto[] =…
-
1
votes1
answer5171
viewsCheck if field is empty using custom C reading function
void vazio(void) { char *str = NULL, c;//apontando para null int i = 0, j = 1; //alocação de memória para str str = (char *) malloc (sizeof(char)); printf("Informe a string: "); //ler a string while…
-
1
votes3
answers474
viewsFscanf problem using code::Blocks and Opengl
Does anyone know if there are any restrictions on using fscanf in projects that use GLUT (Opengl)? I’m trying to do something simple... read a cloud of dots (x, y, z) from a text file, but the…
-
1
votes1
answer2287
viewsConsume DLL C on VB6 or C#
I have a DLL (gbasmsb_library.dll) provided by Farmácia Popular responsible for returning some functions for interaction with this environment. I think it is a DLL written in C, I need to consume…
-
1
votes1
answer138
viewsWhat is the difference between the streql() and strcmp() functions of the header string. h?
Both return 1 if two strings are equal and 0 if they are different right ?
-
1
votes1
answer61
viewsFork does not restore variables
The idea of the code is: Give Fork 3 times, that is, from the father create three children (with Count=0,Count=1 and Count=2). The children then, upon returning from the loop will see that their i=0…
casked 9 years, 9 months ago felipe alves 11 -
1
votes2
answers520
viewsProblems with if and conditions
I’m making a code that receives three values and orders them from the highest to the lowest. As a condition, when the numbers are repeated, an error message is displayed and the program must close.…
-
1
votes1
answer40
viewsProblem with the results
I would like to know, in the program I enter with 10 values, and the program calculates the discrete transform of the cosine-II, using this sequence of 10 numbers: 3 5 7 9 7 5 3 5 8 9 Why the first…
casked 9 years, 5 months ago Gabriel Vinicius 23 -
1
votes1
answer474
viewsVariable loses value in C
The code below has the expected behavior in case the values are informed correctly. But when I report, for example, in the following order: preco equal to 1, to quantidade equal to -1 and then the…
casked 9 years, 8 months ago felipe.zkn 166 -
1
votes2
answers250
viewsRepeat loop is not running
I am making a code in which there is a vector (with 15 positions) with predetermined values (10 values any and 5 times the value 0), and where the user will inform a new value to go to the end of…
-
1
votes1
answer147
viewsHow to read the last 3 characters of a char with no set size
I have a C application where I need to read only the last 3 characters of a char. Like the size of this char may vary, I did as follows: memcpy(valor_final, string_total[strlen(string_total - 3)],…
-
1
votes1
answer84
viewsError in a function check
I need to make a code with several specific functions. In one of them, with a square matrix, I need to trace a primary and a secondary line, both cutting in the middle diagonally, leaving the higher…
-
1
votes3
answers187
viewsReturn to condition start when prompted
I can not use function, I wanted to know how to return to a certain line of code when the number 0 is pressed, example: system(color 7); printf("Teste"); printf("Teste01"); printf("Pressione 0 para…
-
1
votes2
answers385
viewsHow to make cmd slower
Is there any command for the cmd run a program I have run from the compiler? I would like to debug what I did and, as I often fall into infinite loop, I want to know if you have how to do the cmd…
-
1
votes1
answer92
viewsRemove http header in socket C
I made a socket in C. This program is command-line operated and compiled over Linux. It takes as parameter a complete URI and a file name, and then connects to the server, retrieves the page and…
-
1
votes1
answer3534
viewsPass and return vector of type defined by struct as parameter of a function in C
I’m finding errors for the following code: #include<stdlib.h> #include<stdio.h> #include<stdbool.h> #include <locale.h> #define true 1 #define false 0 const int limite = 100;…
-
1
votes2
answers87
viewsProblem with vector ordering
Good afternoon, I’m having a problem with a vector ordering exercise, I’ve reviewed the code, it compiles, but I’m not finding the error so the order does not get crescent, varying in certain parts.…
-
1
votes1
answer57
viewsWhen programming an ARM microcontroller, is it possible to change your clock after running Systeminit()?
I resumed my studies on ARM this month, and one question that has long been bothering me and I haven’t yet managed to put the test in my testing environment is whether I can change the…
-
1
votes2
answers83
viewsProblem with random values
Good night, you guys. I’m solving an exercise where I must, at each run, generate a random number and then turn it into a letter. For this I made a function. It is almost all right, the number is…
-
1
votes2
answers132
viewsProblem with second degree equation program
I have an interesting problem in my code, the program reads three numbers and says whether it’s a rectangle triangle or not, but the problem is that depending on the sequence I type in the numbers,…
casked 9 years, 7 months ago Gabriel Vinicius 339 -
1
votes0
answers76
viewsHow to test if a function is already defined in IAR ? (C)
Hello, I am making a library that should be easily portable to other programs. Soon, I tried to do the following: 01 #ifndef delay_ms 02 #define delay_ms(X) OSTimeDlyHMSM(0u, 0u, 0u, (X),…
casked 9 years, 5 months ago wnoliveira 11 -
1
votes1
answer111
viewshow to force a buffer to behave like a string in C?
I am receiving a buffer from the internet, I believe that to go through this buffer and find the last character, you need to find the character ' 0'. But there is no ' 0' in a buffer. It is possible…
-
1
votes1
answer197
viewsWhy doesn’t my code print?
I wonder why this code I’m creating doesn’t print anything when I compile it: #include <stdio.h> #include <stdlib.h> #include <time.h> int main (void) { int dadoacerto, vidadrizzt,…
casked 9 years, 7 months ago Gabriel Vinicius 339 -
1
votes1
answer3328
viewsConcatenate string with integer
I have a variable that is a char vector, and in this vector I need to insert a number that is an integer, searching it for another variable: int quantidade; char id[3] = 'p'; For example, if the…
-
1
votes1
answer543
viewsVariable reading in C with timeout
Does anyone know how to limit the time the user can enter a value? Example: My program prints a value on the screen and the user has 4 seconds to type and enter, if what he typed is = to the printed…
-
1
votes1
answer5250
viewsHow can I solve an "indefinite reference"?
I’m starting now in this life of programmer and I’m trying to perform a program for physics class but at the time of compiling the file is turning me this message... reach. c:(.text+0x68): undefined…
casked 9 years, 7 months ago Roger Vicente 11 -
1
votes1
answer1882
viewsConcatenation of two chained lists in C
Given the TAD LISTA_ENC_NC_ORD, need to implement an operation that takes two lists and returns a list resulting from the concatenation of them, and that cannot have elements with the same value.…
-
1
votes2
answers346
viewssave a data type in a file in c
I have this data structure: typedef struct { ListaCartao tabelaCartao[HASHSIZE]; ListaArtigos tabelaArtigos[HASHSIZE]; char localidade[MAXLOCALIZACAO]; }tCelulaSuperdume, *SuperDume; SuperDume…
-
1
votes2
answers1967
viewsProgramming language directly with hardware
I will make applications that need a direct connection to the hardware, for example a mini-Programmable robot that receives information from a sensor and sends to the programming treat and return…
-
1
votes1
answer132
viewsCross-platform C program
If I make a program in C and don’t use any Windows library leaving the program totally pure in C I can compile it for Linux as well? and will function normally?
-
1
votes2
answers54
viewsHelp with user typing
Hi, I’m doing a Sort Selection program in c, but I’m having a hard time. How or where, and what I put in order for the user to type the array size as well as its elements. I tried so: #include…
-
1
votes1
answer86
viewsI can’t call a string
I created an algorithm that simulates a stock of a dvd sales. It stores name, price and quantity. It has some functions and it enters them, one that informs the quantity and the price of a specific…
-
1
votes1
answer134
viewsMain for function on linked lists
I’m having a hard time creating a main to test if my function is going well. My program is as follows: : Lint fromArray (int v[], int N) which, given an array v with N elements, ordered in ascending…
-
1
votes3
answers1681
viewsFind day of the week of the first day of January from the date of Easter
I have a college assignment in which I must build a calendar on C from the date of Easter of a given year. I can find the date of Easter and correctly build the calendar in ASCII art, but I can’t…
casked 9 years, 6 months ago g.carvalho97 681 -
1
votes2
answers1405
viewsProblem with Struct in C
In that code: #include <stdio.h> #include <stdlib.h> //Usando o struct(Estruturas) struct cadastro { char nome[50]; int idade; char rua[50]; int numero; }; int main() { printf("Digite…
-
1
votes2
answers179
viewsSet position Cursor Windows & Linux with same code
I’m developing a cross-platform application. For this I would like to develop with the minimum of "ifdefs" possible, and what I need to do is basically a fixed screen of 32 x 16 characters. But for…
-
1
votes2
answers2642
viewsPhysically delete a struct type record
I need to physically delete a record created within a struct defined in my program, but in every way I tried (Define it as NULL, Create another struct and save all records that were not deleted on…