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
votes1
answer1089
viewsCalculate distance between two indexes of a matrix?
I want to enter two matrix indexes, and subtract that value. For example I want to enter with index [0, 1] and [2, 10]. And then I want to subtract the value, to calculate the distance I’m between…
-
0
votes1
answer95
viewsWhy does the code generate garbage at the beginning of the vector?
the following code generates an unexpected result, at the end of the loop the first positions of the vector are with stored garbage, someone can tell why this is happening, and where is the error?…
-
0
votes2
answers71
viewsInsert linked list node
I have this function of inserting at the beginning, but I’m not being able to test it. Follows: void inserir_inicio (tipo_lista * p, tipo_lista * novo_no) { novo_no -> prox = p; p = novo_no; } I…
-
0
votes1
answer543
viewsProblem with float and matrix
I have to add the values that have two or more decimals but when I put by Exp: "1.0", it fills this whole row automatically and jumps to the next, I reviewed and I don’t know why you are giving…
-
0
votes1
answer59
viewsProblem reading file
I’m writing a code in C++ and I need to read a distance file that was calculated in another algorithm made in C. This file looks something like this: 100 n (natural number) 0.0000 58.25646 7.1556…
-
0
votes1
answer57
viewsreversing a long sequence in c
I need to invert a sequence of numbers, for example, if 1234 is inserted, I print 4321. The code is working, but for Type 0123 or Type 1230 entries the zero is simply "deleted", but I needed the…
-
0
votes1
answer265
viewsOutput of a void function
I’m programming a word hunt and a problem in the void function is making it difficult. In the code I use functions to scan the matrix in all directions and returns me the initial and final…
-
0
votes2
answers2122
viewsLock letters and special characters
Good afternoon. I am developing a program in C and have to deal with when the user type letters or special characters. It turns out that when I test by typing a letter, the program loops, kind of…
-
0
votes1
answer65
viewsProblem with Struct Research
In my code, I can enter and delete normally, but in the searches it does not print, what could be the problem? I thought it would work the way I did. I’m doing the 'if' correctly? struct fichacarro…
-
0
votes2
answers153
viewsDoubt about code in C
Hello. I’m having doubts about this code. In "case 1", when executing, I see this: The problem is that none of the discounts is applied. I have tried other ways to mount this operation, but all…
casked 7 years, 11 months ago Marcela Fernanda 1 -
0
votes2
answers91
viewsProject linkage problem with more than one source file
This is to my function. It gives me error when calling in main function. This is the header of my function, in the function file1.h int eleminar_numeros_repetidos(int *vec, int n, int *vec1); File…
-
0
votes1
answer1077
viewsC Circular Double Chained List Descending Ordering
I need a little help here with Double Chained Circular List to solve a bigger problem. I need to do a function that already enters my elements in descending order. My code even works with entries…
-
0
votes1
answer842
viewsFunction print circular list
Personal I am with a doubt of where and how I should change to this function of printing circular list get correct. Below is a print function from a linked list: void imprime_lista(tipo_lista* p) {…
-
0
votes1
answer99
viewsPrint multiple matrices separately
I wonder if you have how to print these three matrices without having to create several for's, the printing of the same on the screen should be separated. ( I need an alternative because I have…
-
0
votes2
answers257
viewsHow could I enter the structs in a list?
#include "stdafx.h" #include <iostream> using namespace std; struct FICHA_INSCRICAO { char nome[50]; char cpf[10]; char logradouro[100]; char…
-
0
votes1
answer57
viewsUse of batteries and passage by reference
Hello, I’m doing a program where I have a stack and I want to reorganize the elements of this. I have created a function that performs this only the original stack is not being modified (it is only…
-
0
votes2
answers5430
viewsa Function-Definition is not allowed here before '{' what does this error mean?
I am trying to compile my code, but the compilation returns the following error: a Function-Definition is not allowed here before '{' token| I am beginner and I have looked several times the code to…
-
0
votes2
answers281
viewsDoubt: I did not understand why of continuation
Do a program that receives the age, the weight, the height, the color of the eyes (A - Blue, P -Black, V - Green and C - Brown) and the color of the hair (P - Black, C - Brown, L - Blonde and R -…
casked 8 years, 6 months ago rafael gomes cardoso 21 -
0
votes1
answer321
viewsDoubt in a program in C!!! Simply chained list!
I was trying to make a chained list, but I can’t get her to insert it or print it. If anyone can bring a light to my program I thank you. #include <stdio.h> #include <stdlib.h> typedef…
-
0
votes1
answer262
viewsSyntax error C
I read the chapter of matrices in Herbert Schildt’s book, C complete and total, and I decided to transcribe the algorithm designed to simulate a game of old. In spite of everything, Dev-c++ found a…
casked 8 years, 6 months ago Filipe Teixeira 37 -
0
votes0
answers20
viewsDoes anyone know where I can find the source code for the http protocol?
Does anyone know where I can find the source code for the http protocol? If so, I would like to know a lot.
-
0
votes1
answer86
viewsError creating child node, generalized list
The error is found in else of the method criarFilho, I was able to locate it but I can not find solution for it. The debug Dev-C++ does not point out anything. #include <stdio.h> #include…
-
0
votes1
answer157
viewsChained list in C-add!
I am in doubt in an exercise and if anyone could help me would be very good! Thanks from now! #include <stdio.h> #include <stdlib.h> struct Numeros { int numero; struct Numeros *next; };…
-
0
votes1
answer67
viewsProgramming on Ubuntu, IDE with problem
Good afternoon, I am migrating to Ubuntu and looking for a good IDE with clean visual, here I find the "Builder" and when trying to use the program two errors are displayed but fortunately one…
-
0
votes1
answer86
viewsTexture error in opengl
I’m trying to do some things in C using SDL and opengl, and at the time of drawing textures I can easily if you want only 1 object with texture but when trying to put a texture in the background and…
-
0
votes1
answer1074
viewsHow to replace a middle character of a string and swap for two characters?
For example, Char s1 [ ] = "azul"; Char S2 [ ] = "z"; Char S3 [ ] = "PP"; Puts(s1); //azul Code to replace... Expected result: Puts(s1); //aPPul Note: I was able to change 1 character by another,…
-
0
votes1
answer391
viewsValidation of scanf in c
I have a problem that I need to validate an entry to receive only integers, if I do not receive, I must force the user to enter an integer. I cannot disregard numbers after the comma (in the case of…
-
0
votes0
answers39
viewsHow to copy string from one vector to another vector in C?
I’m trying to create a program that will have a function called substring where the user will place the index position of an origin vector in which it will copy and the size of how many letters it…
-
0
votes2
answers879
viewsPass matrix to C functions
Good evening, next I have a problem passing a matrix to a C function. I have the following code void funcao(int mat[][num]); int main() { scanf(%d,&num); } It is basically the following, I…
-
0
votes1
answer367
viewsGrab file names and put in char array
As I take the filenames of a directory and place them in a multidimensional char array? #include <stdio.h> #include <dirent.h> int main() { char arrayNomes[10][50]; char dirn[50]; DIR…
-
0
votes0
answers196
viewsRegarding Bit to Bit Operators in a sum operation
Hello I have this part of program and I would like to know why should be used these assignments being that only prints the variable b int soma() { int a,b,c; printf("Digite o numero que deseja…
casked 7 years, 9 months ago Henrique001 9 -
0
votes1
answer232
viewsfread and structure memory allocation
I have the following structure: typedef struct registro {//52 bytes char codigo[4]; char descricao[31]; char unidade[3]; int quantidade; float valor; char status; }registro; It must store the values…
-
0
votes1
answer41
viewsFunction for matching points
In an exercise, I need to create a function that returns TRUE if the points are identical. For the points, a structure was implemented as follows: typedef struct //Estrutura definida para os pontos.…
-
0
votes1
answer136
viewsVectors and Matrices
Write a program in C that deciphers words from a matrix that contains the values of the letters of the alphabet, as follows: A = 7, B = 8, C = 9, D = 10, E = 11, etc.Thus the code: a) 9 7 10 7, that…
-
0
votes1
answer19
viewsRenaming a string in a structure vector
Good afternoon guys, I’m catching on to a part of my code and really don’t know the logic to solve it. If the vector manufacturer’s name carros in position j be equal Chevrolet, change him to GM.…
-
0
votes1
answer63
viewsC/C++ Error E2268 : Call to Undefined Function 'fread' in Function retornaClientes()
Hello, I am doing a project for college, in C/C++ (more C language than C++), and I have a serious problem in fread function(). DataManipulation.h | 88 | Error E2285: Could not find a match for…
casked 8 years, 5 months ago João Regis 336 -
0
votes2
answers716
viewsConverts String to int Arduino in C
Good people, I will try to explain my problem. I am developing a little software in Netbeans that communicates with Arduino via Serial Port. My problem is that in Netbeans IDE I am sending String,…
-
0
votes0
answers78
viewsRecording in C information file
So, guys, I’m doing a job that consists essentially of recording information relating to films and series in two files (one for each one). In the code section films. c i have all the functions used…
-
0
votes1
answer247
viewsWhen I try to make a.bin file it gives multiple definition error in all functions
In the Linux i use the following command lines to run all files: gcc -c aluno.c // gera o arquivo objeto com extensão .o de mesmo nome gcc -c teste.c gcc -o prog.bin teste.o aluno.o //para criar o…
-
0
votes2
answers2922
viewsC/C++ library for manipulating images
I would like to know which library to use, which is easy to install for both Windows and Linux, to manipulate images ( png, jpg, etc) in C/C++ ? I would like to open and save it in an array to work…
-
0
votes2
answers720
viewsRecover struct data in C
How do I save a Struct to a C file and recover that data in another run of the program?
casked 7 years, 9 months ago Ricardo Ribeiro 43 -
0
votes1
answer61
viewsDefinition of Macros with Indexing in C
Good afternoon, i wonder if in C has how to make the following definition of macro: #define EXEMPLO(1) a * c + b #define EXEMPLO(2) a + b + c #define EXEMPLO(3) b * c + a And then use indexing in…
-
0
votes1
answer382
viewsOpen, read and write csv
I have a C code that is using the base structure for reading. Read FILE *input; input=fopen(argv[1],"r"); points=(Point*)malloc(sizeof(Point)*num_points); readPoints(input,points,num_points);…
casked 7 years, 9 months ago random2137 1 -
0
votes0
answers287
viewsInsert priority calls into a queue using nested struct
Talk people!!! All beauty? I made another code that is showing the result and I can also de-rank and insert the values removed from this main row into a secondary structure according to the…
-
0
votes1
answer157
viewsHow to remove vector character by pressing Backspace on c
Good evening... I am making an automatic login system and the validation worked agr the only problem is that it is not possible to delete the previous character if the user misses the letter, I…
casked 8 years, 5 months ago Gabriel Ribeiro 163 -
0
votes1
answer247
views -
0
votes1
answer877
viewsRead text file picking float numbers and playing in matrix
I have a text file for example with: v 1.000000 -1.000000 -1.000000 v 1.000000 -1.000000 1.000000 v -1.000000 -1.000000 1.000000 v -1.000000 -1.000000 -1.000000 v 1.000000 1.000000 -0.999999 v…
-
0
votes1
answer33
viewsKnow when a file row starts with a given string
I have a file like this: # Blender v2.69 (sub 0) OBJ File: 'CUBO.blend' # www.blender.org mtllib cube.mtl o Cube.022_Cube.030 v 0.450000 -1.450000 0.550000 v 0.450000 -1.450000 1.450000 v -0.450000…
-
0
votes1
answer25
viewsGet the path of a file within the project in string form
I am using a method that in its parameters I inform a path of an image, Example: Meu_Metodo("image\\test.png"); Only that image is inside Resources, as you can see in this image: What I do to get…
-
0
votes1
answer104
viewsHow do I write the external data entry command in Java?
I migrated from C to Java and would like to know which command allows the user to enter external data and what would this command look like in code. In language in C use the code below:…