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
answer769
viewsKnow how many positions were filled in a vector in C
I cannot display the filled positions in C. I need to return which positions are missing to be filled and which are filled. ex:"So far there are 3 registered students, thus enabling the insertion of…
-
0
votes1
answer71
viewsSegmentation Fault (Dumped Core) Print Numbers
I wrote an algorithm that prints all integers in a closed interval from A to B, with A and B integers. However, when I was compiling and assembling the file on the linux bash, there was a…
casked 8 years, 5 months ago Filipe Teixeira 37 -
0
votes1
answer386
viewsCompile C Error in Gcc - Accentuation
Compiling the C code in GCC, and then running it. An accentuation error occurs: PROGRAM: #include <stdio.h> int main() { printf ("Bem Vindo ao Nosso Jogo de Adivinhação"); } Command Terminal:…
-
0
votes1
answer80
viewsWhen a 'cloned' struct is changed it changes all the others
I have the following statements: #define SCALE 4 #define PADDING 1.1 #define CUBES 27 #define CUBE_VERTICES 8 #define CUBE_FACES 6 #define FACE_VERTICES 4 typedef struct { float angle; float x;…
-
0
votes1
answer2690
viewsProgram Received Signal sigsegv Segmentation fault
I made the code in C of the statement: Develop a program that simulates a ticketing system for a airline. The company has no flights, where in each of them there are a available seats. The first m/2…
-
0
votes1
answer206
viewsHow do I generate a binary executable?
Hi, I wanted to know how to make a program in C generate another binary executable eg: the binary Elf x-Elf.bin when running creates another binary executable y-Elf.bin
-
0
votes1
answer110
views"Segmentation Fault" in a function that performs Quicksort
I am doing a job that asks to create a quicksort function to alphabetically sort a txt file, but it is showing the error: Segmentation fault In the main function I call the function so:…
-
0
votes2
answers54
viewsVector in C- Program Received Signal, Segementation fault
Hello, I designed a function that checks whether a number is present in a vector. A function takes as parameters the vector, the value to be checked and the number of existing elements in it. E…
-
0
votes1
answer536
viewsProgram in c presenting output, strange different from the value of variables
I’m having a problem running a program on and c that when I compile it and run it shows me a value that is not set in my variable I’m thinking it’s some bug with the ide or something related to the…
-
0
votes1
answer2936
viewsHow do I print a hexa in c through the printf?
//example mascara=0xFF; blue= COR1 & mascara;//color a macro I used printf("%s\n", blue);//doubt bold
-
0
votes0
answers44
viewsFind char in a string, never find
I made a function search for a character in a string. The input parameters are the string and the character. The function returns 1 (one) if the character exists in the string or zero otherwise. The…
-
0
votes0
answers110
viewsVector in Opengl
Hello, I’m venturing into Opengl and so far I know the basics of creating figures. I need to create a bar number that goes from 1 to 64, the problem is I need to do this with a FOR. When the first…
-
0
votes0
answers40
viewsThe compilation is done without errors or warnings... But the program does not run!
I’m having some problems with the code below. The program compiles but an error occurs in the execution. From what I understand the problem is in printing... due to variable size size_t size of the…
-
0
votes1
answer135
viewsPressing keys in the terminal
Hello, in my Ubuntu 16.04, at the time of running a program in C (as well as in sublime), when I press a key, keeps repeating the same key until release. So far so good. But if I don’t release this…
-
0
votes1
answer36
viewsHow to send the main program programming directive to some library?
I have a library that generates a result of two allowed. This is given by the definition, within the library itself, of the directives #define __SE8R01__ or #define __RF24L01P__. The case is that…
-
0
votes0
answers186
viewsDelete data in chained dynamic list using C language
Good afternoon. I’m doing a project for the college where the teacher asked to create an algorithm with dynamic lists, where one list should contain customers and another, products. The goal of the…
-
0
votes1
answer91
viewsError in capturing information in files using the fseek() function... What’s the problem?
I’m having trouble with an Info capture function of a file with the fseek() function [I don’t know if there is a better alternative...]. Getting back to the problem, I want to read a file that has:…
-
0
votes1
answer266
viewsWhat would the conversion of this algorithm from C to Python look like
unsigned char CheckSum(unsigned char *uBuff, unsigned char uBuffLen){ unsigned char i, uSum=0; for(i=0; i < uBuffLen; i++){ uSum = uSum + uBuff[i]; } uSum = (~uSum) +…
-
0
votes1
answer871
viewsReturn of a binary search
I have the following question: Develop a recursive function that finds a value in an ordered vector using binary search. The function must respond to the position of the vector value. If the value…
casked 8 years, 5 months ago Pedro Palmuti 1 -
0
votes1
answer70
viewsWarning on battery hands
I’m trying to make a simple stack implementation, however the message appears: Warning: initialization from incompatible Pointer type -Wincompatible-Pointer-types This Warning appears on both line…
-
0
votes1
answer147
viewsReference error in winsock2
I am wanting to create a socket in c with the windows api winsock2.h but while trying to compile my code returns me the following error Undefined referrence to Wsastartup Undefined referrence to…
-
0
votes1
answer752
viewsCompare two simple strings in C, input with scanf();
what I intend to do is quite simple. I make the program ask for a password, the program compares, and if the password is valid, the program proceeds. An example: char pass[5]; printf("insira a…
-
0
votes1
answer59
viewsCounters are not being incremented in code
I am facing some difficulties with the code snippet below: The call of this function is: cache = OperaCache(true , endereco, op, cache, descricao, read_hits, read_misses, write_hits, write_misses);…
-
0
votes1
answer75
viewsPointer error with dynamic library calling
I’m wanting a method within a dynamic library to read the value from within a pointer using dlfcn.h. But it always has memory error when I try to access the value inside the pointer. main. c…
casked 8 years, 4 months ago Brumazzi DB 4,345 -
0
votes2
answers81
views(Error of Segmentation fault)
People don’t know where the bug is. Every time I compile it accuses error of Segmentation fault (core dumped), can anyone help me? The code is here: #include <stdio.h> int strlen(char *s);…
-
0
votes1
answer4313
viewsHow to delete the contents of a file in c?
How can I delete the contents of a file in c, which function should I use? #include <stdio.h> #include <stdlib.h> void main(){ char hello[13] = "Hello World!"; char path[12] =…
-
0
votes1
answer318
viewsCode in the c++ dev of the problem, but in another compiler it works
The code is stopping responding at the last execution. #include <stdio.h> #include <stdlib.h> #include <conio.h> #include <string.h> /* run this program using the console…
-
0
votes1
answer1168
viewsFunction with vectors in C
I would like to know what a function in C would look like if it received a vector with N elements and returned the amount of elements that are above the arithmetic mean of the vector itself.
casked 7 years, 6 months ago Mateus Santos 19 -
0
votes3
answers454
viewsLoop of repetition in C
Hello, I’m a beginner in programming and I have a question: I’m making a program that has a menu and a registration to be performed by the user. I would like to know how to make the menu of the…
-
0
votes1
answer77
viewsexercise on pointers
Implements the function void power_ref(int* x, int y) which calculates the power of x leading to y. The result must be placed at the address indicated in the first parameter, changing its initial…
casked 7 years, 6 months ago Beatriz Ferreira 1 -
0
votes1
answer2016
viewsHow to make an appointment in C language?
Good evening, I’m doing a little project of writing binary files in a txt and then reading these files. But I have to read the file or list them all. How could I do a search for the necessary file?…
-
0
votes1
answer16507
viewsHow to print a string from a string array in C?
I have a string vector(palavras[x][y]), I can read every word that will be an element of the vector, but I cannot print any of these stored words. printf("%s",palavras[a][b]), doesn’t work. Here are…
-
0
votes1
answer241
viewsHow to catch the line below (next line) in C?
Good morning people, I have a file that contains several lines, among them the following: REMARK Evaluations: CoarseFF Proper-dihedrals Coarse Atomic Repulsion Coarse Compaktr Hbond_Strands…
-
0
votes1
answer65
viewsarray type has incomplete element type
I am not able to compile my program, the compiler keeps accusing "array type has incomplete element type" in the function that prints points. The function that prints dot: float imprimePonto(struct…
-
0
votes2
answers329
viewsSize of a dynamic array
I’m testing with dynamic memory allocation, but when I try to get the array size I always get the same result. int main() { int *teste=malloc(sizeof(int) * 10); int len=sizeof(teste) / sizeof(int);…
-
0
votes1
answer54
views"Compress" values from an array of shorts, to an array of integers
Good evening. I have to solve an exercise for evaluation in which I have no idea how to do it. I have to compress 2 consecutive values of an array of shorts to be saved in an array of integers. This…
-
0
votes2
answers1127
views -
0
votes1
answer395
viewsJoin multiple mp3 files into a single mp3 file
Hello! I would like to create a program (in C language or other capable) that receives as input a text and return me as output a song. For this I would need a text file (.txt) where I would need to…
-
0
votes1
answer98
viewsWhy does this infinite loop happen?
I made this code but it keeps giving endless loop and I can’t fix... #include <stdio.h> int main (){ int x, z; while("x=100; x!=65; x-=5"){ z=x*x; printf("%d --> %d\n", x, z); } }…
-
0
votes0
answers605
viewsRuntime error on URI Judge Online?
I am unable to find out the Runtime error of this program. The question link: https://www.urionlinejudge.com.br/judge/pt/problems/view/1245 #include <stdio.h> int main() { int…
-
0
votes2
answers29835
viewsWhat do I need to fix? [Error] Ld returned 1 Exit status
I am not able to compile this code at all. I have already &'s within the scanf's and printf's and nothing to change the end result. Where I need to change my code? #include<stdio.h>…
casked 8 years, 4 months ago Thales Rodrigues 11 -
0
votes1
answer1327
viewsBuild error "Undefined Reference to `sqrt' " in Atom editor
This C code is not compiling in Atom, but in Codeblocks it is working normally. #include <stdio.h> #include <math.h> int main(){ int a, b, hipotenusa, catetos; printf("A: "); scanf("%d",…
-
0
votes1
answer135
viewsWord in reverse order
I’m doing an exercise where I have to make the word given with input exit in reverse order. I start by counting the number of letters you have in the typed word (commented on in the code). After…
-
0
votes1
answer77
viewsRunning gives me a mistake and I can’t identify
I run my program and it’s all right until I get to "l[strlen(l) - 1] = l[strlen(l)]; while (fgets(ll, sizeof (ll), "EventosDesportivosFutebol.txt") != NULL)", (doing the debug I was able to find out…
casked 8 years, 3 months ago ricascross 1 -
0
votes1
answer815
viewsHow do I create a char variable with an indeterminate size
How do I create a char* variable (to store a name) with an indeterminate size? Example: char nome[30] = { 0 } // 30 é o valor máximo e no caso se a pessoa tiver um nome grande? que ultrapasse 30?…
-
0
votes3
answers1680
viewsHow to put a whole word inside a char?
How do I place a word with letters and numbers inside a char? For example put on it the license plate of an ABC-1234 car. char a = ABC1234; char b = DFG0000; printf("1ª placa %s\n",a); printf("2ª…
-
0
votes1
answer187
viewsHow to declare "strings" accented strings?
Lua is written in C logo shares the American Standard Code for Information Exchange "ASCII" Accepts matrix key declaration with accent: rafael = {} rafael["é"]="eu" print(rafael["é"]) --saída: eu…
-
0
votes1
answer544
viewsError: assignment of Member '' in read-only Object
#include <stdio.h> #include <stdlib.h> typedef struct Ecoponto{ int codigo; int contentores[3]; char *cidade; char *rua; int nporta; }ecoponto; int insereEcoponto (const struct Ecoponto…
-
0
votes2
answers4111
viewsCopy string from a given character
I am developing a C program that will work with 02 files .txt The first file, is a report, that goes straight out of the system, and in it are information like item code, location and quantity in…
-
0
votes1
answer286
viewsWhat is the function of this code snippet? Data structure (List)
I need to understand what each command of this is capable of doing, as it is without comment. struct Node{ int num; struct Node *prox; }; typedef struct Node node; int tam; int vazia(node *LISTA) {…