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
answers5028
viewsHow to put each line of a txt file into a vector?
The file has only 3 lines as content, which must be so: Idade = 15 Nome = Alvaro Apelido = Costa this file is only open for reading with fopen in "r mode". So I have 3 variables declared in the…
casked 9 years, 1 month ago user3903094 75 -
1
votes1
answer346
viewsError: Undefined reference to 'sqlite3_open'
I am creating a software in C that uses Sqlite 3 as database, however, when compiling the project Codeblocks returns me the following error message: createdata. c|| undefined reference to…
-
1
votes2
answers74
viewsUsing functions
Good afternoon! I am implementing a game of stone, paper and scissors, where occurs the application of functions, with and without argument and return. I was in doubt, after the program identify the…
-
1
votes2
answers1114
viewsLine break does not work on file
I take the elements of a list but at the time of saving it not saved with line break saves everything in the same line. fprintf(arquivo, "%s\n", p->infoLinha);
-
1
votes2
answers577
viewshow to compare null/null value when type character in C
printf("\nteste -> "); scanf("%i", &opAjuda); /* opAhelp is to receive a whole, but I want to do an if here, saying that if a person writes a character instead of the whole one, it goes to…
-
1
votes2
answers57
viewsRedirect Flex input to a string
Good, I have a flex file and a C routine to check the writing of texts. I’ve been testing at command-prompt using test < inputFile What I wanted now was to be able to indicate in my C file a…
-
1
votes1
answer108
viewsAlgorithm for sorting the elements of a data set
"A team needs to write an algorithm that sorts the elements of a data set, from a certain criterion defined by the function. Knowing that the data set does not have more than 100 elements and that…
-
1
votes1
answer10254
viewsHow to use . h files in c language?
I would like to know which is the most recommended use of the files *.h? Because I don’t know if I can use them just to get the prototype of the functions or the full function.
casked 8 years, 9 months ago Guto.Diniz 123 -
1
votes1
answer88
viewsExit loop as soon as the string name equals 0
#include <iostream> #include <locale.h> #include <stdlib.h> #include <stdio.h> #include <string.h> using namespace std; int…
-
1
votes1
answer5307
viewsSpace in a String C
I’m starting to learn C, and I came across the following doubt: When I ask the user to inform me a song or artist, he ends up informing me a song with spaces, like "AS I AM", however the program…
-
1
votes1
answer119
viewsHow to block the insertion of information using a List
Well I’m using list structure and I’ve tried everything and so far I can’t. I am trying to get the product entity to receive ONLY the CPF from a vendor. The entity Product works when the entity…
-
1
votes1
answer2495
viewsFunction reverses numbers in array
How this function works in c reversing the numbers? void inverte(int vetor[MAX], int n) { int i,aux; for (i = 0; i < n/2; i++) { // troca posicao i por n-1-i aux = vetor[i]; vetor[i] =…
-
1
votes1
answer108
viewsRead from file and use read parts to call functions
I have a file that contains calls to functions present in my code. Some examples of functions are criar(), inserir(elemento, conjunto), listar(conjunto) where the arguments are integers passed to…
-
1
votes1
answer89
viewsHow to find something specific inside a Text file
Hello, I have to check the grades of a certain student and if his average is greater than 5 show the name so I have no idea how to do it... nor to ask how does it so excuse me if I was unclear…
-
1
votes1
answer349
viewsHow do I create a list of arrangements to save a struct?
Someone would help me create an array-like structure so I can implement a struct containing an ID, a priority (medium, low, high, urgent) and a phone? basically: typedef struct Atividades{ int id;…
casked 8 years, 8 months ago Vinícius Barbosa 11 -
1
votes2
answers1876
viewsHow to get the serial number or ID of a USB stick on the MS-DOS system?
I have tried using some tools to get hardware information on DOS, but they did not have the source code for free use. I need a code solution that returns the serial number or ID in the MS-DOS…
-
1
votes2
answers38081
viewsCalculate vector size
How to calculate the vector size? My code: #include <stdio.h> #include <stdlib.h> int retornaMediana(int *vetor){ int tam=0; tam = sizeof(vetor); printf("TESTE: %d, %d,…
-
1
votes2
answers203
viewsErrors with C array manipulation
Through the following code: #include<stdio.h> #include<string.h> int main(){ //Declaração de Variáveis char jogo; char times[20][15] = {"Corinthians","Atlético-MG","Grêmio","Santos","São…
-
1
votes1
answer1009
viewsLogic for Cobrinha game
Hello I’m wanting to make a game of the C cover using the curses library, I started, but I’m not finding a logic to draw the Snake on the screen when the user presses the arrows, I want to know what…
casked 8 years, 8 months ago Andrey França 2,313 -
1
votes1
answer120
viewsHow to perform an operation without showing the result in C?
I need a way that the program performs an account between variables x and y and save the result in a variable z, how do I do it in C?
-
1
votes1
answer675
viewsCopy files in c
In C language, how do I copy the file gg.bat for "%AppData%\Roaming\Microsoft\Windows\Start Menu\Programs\Startup" I tried with system("copy \"gg.bat\" \"%%appdata%%\\microsoft\\windows\\start…
-
1
votes1
answer583
viewsCopia de Vetores
good night! I have a question about how to copy a vector. I declared a "matrix [a][j]" vector and I need to take the arithmetic mean only from the values contained in "matrix[a]", so I need to make…
-
1
votes1
answer2118
viewsWhile Loop in Assembly MIPS
Good morning guys, I’m new to Assembly and I’m in need of a little help if possible. I need to translate the following code to Assembly: // Sendo i,total e n os registradors $s1, $s2, $s3 i=0;…
-
1
votes1
answer854
viewsWhat is the use of the extern keyword in c?
I saw on the site with link below that in ANSI C pattern there is the extern keyword, but never seen being used in practice. What exactly does it? http://tigcc.ticalc.org/doc/keywords.html…
casked 8 years, 7 months ago Sérgio Mucciaccia 2,745 -
1
votes1
answer146
viewsCan someone help me with this program on Ansi C, CRUD program?
I tried to erase half of the code and leave it only with the first block, but keeps giving error in the operators and in each scanf that I give, being that I need to find a way to assign the values…
-
1
votes1
answer860
viewsHow to solve the problem of accentuation in the terminal?
I’m writing some strings on screen using the Opengl library and some of the words saved are accentuated words, example: república checa, where the exit ends up being: repblica checa has how to solve…
-
1
votes1
answer898
viewsInterpret the JSON response of a Webservice that was called by Arduino
How do I interpret information from a Webservice who was called by the Arduino? Webservice returns a JSON and I need to interpret it. An example of the answer can be seen below: [{"valor":"10"}] The…
-
1
votes2
answers276
views -
1
votes1
answer560
viewsGet ID of a process
I wanted to get an ID of a process because I would like to use the kill() to send signals from a process to that. I know that to get the ID of the process itself is used getpid() however do not know…
casked 8 years, 6 months ago José Cunha 411 -
1
votes2
answers308
viewsBit array in c doubt
People were looking at some examples of bit array and saw the following function: char get_bit(char *array, int index) { return 1 & (array[index / 8] >> (index % 8)); } I couldn’t…
-
1
votes0
answers260
viewsCan anyone help me with the greedy algorithm problem (Greedy Algorithm)?
The problem asks to do the following: Cut a steel rod of length n to get the maximum possible recipe( Rod Cutting). Present in algorithm with backtraking(already done) and find a solution with…
-
1
votes1
answer68
viewsHow to create a standard map chart?
I need to create a graphic standard map. Is it possible to plot graphics using the C language? I know the basic data structure, algorithms and the c language, but I can’t create a graphical…
-
1
votes0
answers243
viewsUDP client and server send data but do not receive (C windows)
Hello I am trying to create an application that performs data exchange on the network, for that there is an initial connection using TCP sockets that is working normally, then comes the use of UDP…
-
1
votes1
answer81
viewsFind path of a file only given the name
I am trying to find the path of a file just knowing its name. I have tried several ways including pwd but it’s no use to me. There will be some way to do it ? (I have assurance that this is the only…
-
1
votes2
answers61
viewsWhy "Segmentation fault " when two arrays are interspersed?
I’m building a simple c/c++ program that intersperses two arrays but I am encountering an inconvenient error. I believe when calling the function IntercalarArranjos, the program shows an error of…
-
1
votes2
answers106
viewsCapture a 3D click in openGL
I am doing a job in openGL. I wanted to click on a window and a drawing appear where it was clicked. As the scenario is in 3D wanted to know how I do to get the value of the coordinate in Z. Could…
-
1
votes1
answer137
viewsInversion of Array
I want to invert an array, example: void exercicio5() { float array[6] = {10.1, 11.2, 12.3, 127.0, 512.17, -2.5}; float inverso[6]; int cont, x = 6; for (cont = 0; cont < 6; cont++) { x--;…
-
1
votes1
answer417
viewsHow to pass an integer with two digits, causing each digit to be in a position in the vector?
I make the sum of two numbers 5 and 5, how to pass the result (10) as follows: vetor[0]=1 and vetor[1]=0, that is, separate the result for each position of my vector, without the vetor[0] receive…
-
1
votes1
answer226
viewsSegmentation fault function fgets
I’m having a problem segmentation fault in file opening txt. I know for manipulating strings, higher level liguagens, but I have no way to learn now, so I’m using C. My problem is to read a list…
-
1
votes1
answer90
viewsSDL - C - How to check if the mouse pointer is on an image?
Hello, I’m starting a learning about the SDL C graphical interface and I plan to make a menu. In this menu there will be options and when the user hovers over some, it will change color (yellow to…
-
1
votes1
answer1115
viewsProblem with split function in C
Hi, I’m studying the C language and came across a pointer problem in a string breaking function. I use the version GCC 4.8.4. The error value is "1234|123|123|123|123" 4/3/3/3, while other values…
-
1
votes2
answers2433
viewsHow to make a local variable global in C (or C++)?
I can turn a local variable into a global variable, even though it’s within a function? In C or even C++ if it doesn’t exist in C. I’ve seen something like this in Java, but I don’t know exactly how…
-
1
votes1
answer119
viewsError reading and comparing matrix numbers
The program must read a number and compare with the numbers of any 3x3 matrix if the number belongs to a column of the matrix it must print the position, when type 1 it prints two positions, but 1…
-
1
votes1
answer31
viewsError collecting va_list value in C
Good afternoon. I came across a problem at the time of preparing the va_list in c. of two similar codes, one works and the other persists in error. extern bool _sqlite3_insert(const char *table,…
-
1
votes1
answer113
viewsPower using recursion
Well, I’m doing a basic code in C, I’m not very good with this language, I’m learning it, although I’ve seen it not used much. It consists of doing the power operation through recursion. The problem…
-
1
votes1
answer418
viewsFunction int(*Cmp)(void*,void*)
I know it compares pointers and returns an integer that determines whether one is smaller than another, in order. But, when I will use it in main(), is giving some error. Can help me?…
-
1
votes1
answer175
viewsHelp with list and file
Well, I need to pass a chained list to a file and I did a function for it but I can’t. Besides I’ve done several tests and I couldn’t. #include <stdio.h> #include <stdlib.h> typedef…
-
1
votes1
answer3898
viewsC file manipulation (skip lines)
Hello, I’m having a problem to skip lines in a file, I use fgets(), but it always prints the first line of my file. I also did some tests, and for some reason, there is only one iteration and x…
-
1
votes1
answer5005
viewsURI Problem 1061
Hello guys I’m using a site to try to do some programming dessafios o https://www.urionlinejudge.com.br I’m in exercise 1061:https://www.urionlinejudge.com.br/repository/UOJ_1061.html When I send my…
casked 8 years, 8 months ago Vinicius Clemente 365 -
1
votes1
answer184
viewsBuild error with struct
While trying to compile I am facing the following error: ..: error: storage size of 'PPFila' isn't known ..: error: storage size of 'AUTFila' isn't known On this code line struct Fila PPFila,…