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
votes2
answers7160
viewsDecimal to binary conversion in C language
The code below, from the original (http://www.programasprontos.com/algoritmos-conversores/conversao-decimal-para-binario-c/) "prints" a decimal number between 0 and 255 in binary. #include…
-
1
votes2
answers363
viewsFile reading
I need to read from a file the amount of tests to be done and which tests to be done. The input file is as follows: 4 //Numero de testes a serem feitos 1 LINSIMP 3 //Primeiro(1) teste que verifica…
-
1
votes0
answers555
viewsPlay Tic-tac-toe with Minimax. Problem printing moves
Me and two other friends are doing an old game in C using Minimax and tree as a Data Structure project and we are having trouble receiving the move, and also when showing it to the user. We believe…
-
1
votes1
answer59
viewsError in reading file
I need to create functions that read from an.txt input file: Number of points Coordinates of the points Number of lines Number of vertices of each line Coordinates of each vertex of the line…
-
1
votes0
answers185
viewsC - Program recording PIC 18F4550 via USB
At first, I’m a layman when it comes to programming. Because of this, I am developing fast and easy programs to improve my knowledge gradually.. I have a development board of a PIC18F4550, with LEDS…
-
1
votes1
answer647
viewsHow to manipulate a vector of structs in an external function? Follow example
I am doubtful on a question. Follow the statement: Implement a library control system with functions to register, query, change and remove books. The attributes of a book are: Name (Book title with…
-
1
votes1
answer658
viewsIs the null character 0 automatically placed at the end of the string or not because I limited the scanf?
#include <stdio.h> #include <stdlib.h> int main(void) { char nome[20]; char sobrenome[20]; char nomeSobrenome[40]; printf("Insira seu nome e…
-
1
votes2
answers183
viewsHow to implement this while not from Python in C?
I’m studying a Python code I need to turn to C, but the part that’s confusing me is this: while not(f1 == 0 and fn == 1): ... How would this same code be in C language?…
-
1
votes2
answers99
viewsImage Processing? Doubt on the subject and usability
You guys talk all right ? I have a doubt if that’s the same name of the theme Image Processing I don’t know if you’ve ever looked there are some apps that carry a proposal like this. There is a…
-
1
votes0
answers30
views -
1
votes1
answer675
viewsWhich is the most up-to-date version of the C language and which compiler works best?
Which is the most up-to-date version of the C language and which compiler works best?
-
1
votes2
answers108
viewsIf you are not checking the condition correctly
I was trying to make a very basic little program to know if a variable had a second decimal place or not. However I came across a "bug", which in my view is bizarre. Code: #include <stdio.h>…
-
1
votes1
answer614
viewsrow items in a row (pointers)
Hello, I am implementing a function to insert elements in a queue and I realized that after the first element inserted, the pointer headPtr and tailPtrestão apontando para o mesmo lugar, logo o…
casked 7 years, 4 months ago Otavio Augusto 158 -
1
votes0
answers30
viewsMini Akinator - allocate line by line.txt file in vector
I am improving a code I made for a college job. A very simplified version of Akinator. Before I did everything in the main code, now I want to read the characters of a txt file. I already created…
-
1
votes1
answer90
viewsfprintf() C error when printing, value displayed(-1,#R) other than being allocated(0)
I’m making a program that basically takes a float, calculates a percentage under the value if you want to record, will record the information in a txt to be incremented now (basically used as a…
casked 7 years, 4 months ago Gabriel Guerra 13 -
1
votes1
answer3977
viewsWarning: assignment makes Pointer from integer without a cast
I did some research, but I don’t quite understand what that means and what it says about my code. I have that function cria_palavra which returns a pointer, there in the main, when I will receive…
-
1
votes2
answers1557
viewsNumber of recursive function calls
Hello. How could you know how many times a function is called recursively by its code? For example, in the code below, how to know how many asterisks the function prints for a given value n? int…
-
1
votes1
answer61
viewsList
I need to create a road map, where each path points to another and so on. I’m using pointer pointer to a list, so I can build something similar to an adjacency list, but at the time of entering the…
-
1
votes1
answer592
viewsChange pointer address in a function
I’m having trouble changing the address of a pointer within a function. I declare the pointer within the function, then pass it by parameter to another function. This other function should cause the…
-
1
votes1
answer234
viewsProblem implementing a chained list - list insertion
I’m trying to accomplish this implementation in C. I’m having two problems. First: Inside the main, I log the data I want and when I go to insert in the list I get a problem. Second: My data reading…
-
1
votes0
answers49
viewsWhat are C-levels?
Today I was reading something about c and I found the word 'trigraphs', I saw some strange codes, like ??! what that means, and why it is not very common to find?
-
1
votes3
answers1572
viewsHow to read only whole numbers in the scanf?
For example, in the code: int main() { int x; scanf("%d", &x); printf("%d", x); } If I type "A", it automatically converts to whole or just closes the program (both happened to me). then, in…
-
1
votes2
answers278
viewsNo match for 'Operator==' in find C function
TipoApontador find (TipoItem x, TipoLista *lista){ TipoApontador aux; if (lista->primeiro != NULL){ aux = lista->primeiro; while (aux!=NULL){ if (aux->item == x) return aux; aux =…
-
1
votes1
answer83
viewsChained List Value Printing - Pointer Problem (C Language)
I’m having trouble printing out the values on my list. I believe the function is right, however the following error is happening when I try to compile: "error: expect declaration specifiers or ..…
-
1
votes1
answer95
viewserror when zeroing a string
I’m in a problem in my code where when zero the string and add new words it just stores the first part. code goes below: printf("Digite o nome do seu laboratorio:\n"); gets(nome_lab); printf("O nome…
casked 7 years, 4 months ago Gabriel Leite 35 -
1
votes1
answer116
viewsHow to make a clock / how to make it run in the background?
I am making a code that rotates a clock to show when the time of use of a machine (informed by the user). In the code the clock is inside a while(1), so there is no way for the user to inform the…
casked 7 years, 4 months ago Gabriel Leite 35 -
1
votes1
answer248
viewsHighest value in a fixed vector of 10 positions
I have pending exercise to find the largest element in a fixed vector of 10 elements. However, when declaring the array integers works, but when I ask the user to enter the values does not work. int…
-
1
votes1
answer83
viewsPartitioning the algorithm into functions
The problem is this: a function takes an int as parameter, and returns it written backwards and another to test whether the input number and the inverted number is palindromic or not. I was able to…
-
1
votes1
answer3423
viewsBinary Tree Implementation - C Language
I’m trying to insert a tree node. I am using this code, but there are a number of small errors that I cannot understand why of the errors. The last of them is related to valor1, which is not stated.…
-
1
votes1
answer41
viewsRead a string from a File with space
Hello, I want to read a file line and then returns the number of spaces too, but first I’m trying to return the entire string but when I enter a space is not displayed the rest of the string after…
-
1
votes1
answer1566
viewsHow to create a function that inserts elements from two double-chained circular lists
Well, I would like a hint of how I create the function that gets list1 and Lista2 and returns a third list with the elements interspersed from list 1 and 2, what would be the logic? my code is like…
-
1
votes2
answers112
viewswant to read more than 1 file . txt in C
I wanted to create several files. txt and I did it through a loop, and I got it. But I group the only way I can read all the files is by making another loop, example: makes a looping of 3 passwords,…
-
1
votes1
answer2467
viewsHow to count the total Characters of a txt file, including spaces and ' n'?
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { FILE *arquivoRead; FILE *arquivoEscrita; char ch; int count=0; int lin, col;…
-
1
votes2
answers396
viewsDoubt about struct and list in c
I’m having trouble when you need to give a value to a person, in case I need to give the value name and age to the person. I tried to create a struct PESSOA and a list containing a person and an id,…
-
1
votes1
answer594
viewsReceive user vector in C
Hello, everyone. I need help getting an array of integers (separated by spaces) from the user. Here’s my code: #include <stdio.h> #include <stdlib.h> #include <string.h>…
-
1
votes1
answer127
viewsMatrix error as function parameter
Good night. I have a problem using an array as a parameter in my functions. I have in a function that has an int matrix as parameter, when I call the matrix step an original matrix, and in the…
-
1
votes1
answer103
viewsGreater precision in two-point distance problem
I’m trying to solve a minimal tree-generating problem, where I try to find the minimum way to connect all of us. The nodes represent objects with position defined by x, y (integer numbers) in space,…
-
1
votes2
answers1174
viewsData Comparison in Files [C]
I want to make an algorithm that takes a name in an X file and see if this name exists in another Y file, if it does not exist it writes that name in a third Z file. (Basically an algorithm that…
-
1
votes2
answers659
viewsMaximum size of a character array
Has some maximum quantity, that a variable of type char character support? For example, I could use char texto[1000];? #include <stdio.h> #include <stdlib.h> #include <locale.h>…
-
1
votes0
answers50
viewsHow to execute ROL instruction in Assembly inline?
Guys, I have a problem to execute the instruction to scroll left in Assembly in a C code. All the sites I research show this way, but the compiler says there are many memory references to "ROL". I…
-
1
votes1
answer66
viewsDoubt pointers in C
I have a whole number nI wish to break (separate your digits) and store in a vector, but my code does not work... what I am missing? #define TRUE 1 #define FALSE 0 #define DIM1 3 #define DIM2 3…
casked 7 years, 3 months ago Sergio Souza Novak 513 -
1
votes1
answer56
viewsPassing by reference, and saving data from a file in a vector
I’m having trouble saving the read data from a text file and a vector from a structure I created. My goal is to open a text file, take the data that is saved in it, and save in an array of type…
-
1
votes1
answer82
viewsReading only odd records
Initially, I had to create a program to save data from a struct to a file. The struct is as follows:: typedef struct { char nome[30]; int matricula; char conceito; } TipoAluno; I made the program in…
-
1
votes1
answer52
viewsHow do I pass String.Concat "/" [""; "usr"; "local"; "bin"] to c?
I know a lot of things in c, but this is new to me, but, see below with Ocaml: Generating a component file name: Note that the second argument is a list of strings. String.Concat "/" [""; "usr";…
-
1
votes1
answer74
viewsGetopenfilename() used with user personification
I have a process that requires SYSTEM privileges and for this purpose is launched by a service. When this process executes the function Getopenfilename() to open a select file dialog box, I get an…
-
1
votes2
answers267
viewsWhen to actually use malloc() and/or calloc()?
My doubt is due to the fact that I am learning from banal examples (in my view), as in: int *ptr; ptr = malloc(sizeof(int)); It seems to me useless to allocate a space of an integer to a pointer of…
-
1
votes0
answers134
viewsNested Struct - Difficulty in understanding the concept
I have the following structures: typedef struct DataNode { int id; } DataNode; typedef struct Node { DataNode data; struct Node *Next; } Node; typedef struct List { int size; Node *head; } List; I…
-
1
votes0
answers80
viewsCommunication with keyboard with PS2 display
I need to develop communication with the display of a keyboard (44key keytec mark) using windows. In C, for linux, using #include , the inb() and outb() functions works correctly. For windows, the…
-
1
votes1
answer44
viewsHow to ignore the last element in recursive call
I’m implementing a C tree, and one of my methods prints my tree in preorder, and separating the numbers with -. I created that function: void ImprimePreOrdem(TipoApontador arv){ if(arv!=NULL){…
-
1
votes2
answers9812
viewsWhat does the expression `system("pause")` do?
What is the command for system("pause"); ?
casked 5 years, 11 months ago João Vitor Camargo de Alemida 151