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 answer286 viewsWhy are you giving him endless noose?Exercise: Write an algorithm to generate and write a table with s sine values of an angle A in radians, using the series of Truncated Mac-Laurin, presented below: A3 A5 A7 sen A = A - 6 + 120 - 5040… casked 8 years, 6 months ago Bruno Esteves 31
- 
		-1 votes1 answer255 viewsBug in a C codeI know, this code is very simple and this bit ugly tbm, I am beginner and I am trying to facilitate this function, someone can tell me what the mistake? Screenshot of the bug: #include… 
- 
		-1 votes1 answer164 viewsPass vector as argument to a functionI’m trying to pass a vector to a C function, but I don’t know what I’m doing wrong. Since the code is small, I’ll post in full: #include <stdio.h> int calcula(double A){ if(A<=10.0){… 
- 
		-1 votes1 answer453 viewsHow to read an integer with no limit of digits in CIt has some way of reading an integer from the keyboard without limit control of digits. Like I need to pass a giant number via keyboard to a variable and then pass all the digits of that number to… 
- 
		-1 votes3 answers1148 viewsHow to concatenate strings without using a function?Good afternoon guys, I have this question. How do I concatenate two strings without using function or library for this? 
- 
		-1 votes2 answers2149 viewsHow to detect the largest word of a string in C?I came across this problem during a personal project, it is more curiosity really, I would like to ask anyone who can give me a light on this, because I have solved the problem in other languages… 
- 
		-1 votes2 answers266 viewsHow to add functions in C programs?I need to know how to introduce functions into any program. If someone can give me an example in this program here, maybe I can apply it to others as well. I need to understand the logic of how to… 
- 
		-1 votes1 answer45 viewsSeg Fault Core DumpedI’m having this error in the code and I can’t find the problem, can anyone point out to me what I’m doing wrong? What the code does: I get row and column of matrix A, after matrix B, check if they… casked 8 years, 5 months ago Alexandre Pedrecal 85
- 
		-1 votes1 answer135 viewsHow to access a database using CI wonder if you have any way to access a C database? 
- 
		-1 votes1 answer514 viewsHow to rename a program process in C C++ (Windows Lib)I am creating a utility program for windows but can’t change the name that appears in task manager, I have tried SetConsoleTitle("atwconnect"); but changed only the window name but not the process… 
- 
		-1 votes1 answer61 viewsCode error repeating values in threads?#include <pthread.h> #include <stdio.h> void *Operacao(void *soma) { int n; printf(“Digite o primeiro numero:”); scanf("%d", &n); printf(“Digite o segundo numero:”); scanf("%d",… 
- 
		-1 votes2 answers146 viewsWhere is the error of that code?Exercise: Perform a procedure that returns, by parameter, a vector A(5) with the first 5 perfect numbers. My Code: #include <stdio.h> #define TAM 5 void numeros_perfeitos(int A[]) { int cont =… casked 8 years, 5 months ago Bruno Esteves 31
- 
		-1 votes1 answer122 viewsProblem with passing parameters/return of function matrices in CI’m having a problem with a job I have to do in C consisting of, get the inverse matrix through the adjunct matrix. So far this is what I’ve been able to produce in C# and then tried to rewrite in… 
- 
		-1 votes1 answer76 viewsDoubts about pointers and dynamic allocationI’m having difficulty doing this activity. If possible, give me tips and solutions to improve the code. And explain to me why the compiler can run the program but when arriving at the end of the… 
- 
		-1 votes1 answer97 viewshow do I resolve this exercise in c/c++at the end I still need to print which stores are presenting a price within the media, someone help me; #include<bits/stdc++.h> struct difsites{ double preco; char loja[50]; char site[50]; };… 
- 
		-1 votes1 answer871 views
- 
		-1 votes2 answers701 viewsHow do I use %d or %c... in Cout instruction?I am studying C and C++ and would like to understand how I could transform this code written with printf() in cout, or how to use the functions %d %x %c, etc. in the cout. int main() { printf("i… 
- 
		-1 votes1 answer79 viewsObject counter in CI have a job in c language Data Structure to do which consists of the following: Create a program that opens a bmp file, read pixel by pixel, count the objects of that file and Batch a "binarized"… casked 7 years, 2 months ago gabriel.butkus 13
- 
		-1 votes1 answer41 viewsIncrement and Decrease OperatorsWhy didn’t it add up the value of variable 1 , plus 1 in the first printf. int numero = 1; printf("Conteudo armazenado na variavel: %d\n", numero++); /*(por que aqui da resultado 1? não estou… casked 7 years, 2 months ago Vitor Gonçalves 552
- 
		-1 votes1 answer973 viewsHow to put a color in ONLY one variable in C?How can I put a color in ONLY one variable of my code in C? I could only change all the colors of ALL of the letters with system("color 02"); with the library #include <conio.h>. But how do I… 
- 
		-1 votes1 answer560 viewshow to check a string in ifI have the code: Why it is not giving positive for the if? { char placa[9] = "G" "A" "E" "-" "0" "2" "4" "4"; char cor[15] = "branco"; int ano = 2001; printf("A placa: %s\n", placa); printf("A cor:… casked 7 years, 2 months ago Vitor Gonçalves 552
- 
		-1 votes2 answers505 viewsChange the vector size during the course of the program?I want to change the size of the vector to solve this problem "The Legend of Flavious Josephus": https://www.urionlinejudge.com.br/judge/pt/problems/view/1030 If I have 5 people with a 2 jump it… 
- 
		-1 votes1 answer1955 viewsHow do I ask the user to type the vector size?I’m just using vectors with a defined number using the define or even direct on the variable. How I put the amount of vectors the user chooses?. example: #define NUMERO x int main() { int… casked 7 years, 1 month ago Vitor Gonçalves 552
- 
		-1 votes2 answers88 viewsIs it possible to view all the content of a C++ namespace?When you make the directive: using namespace std; //primeira forma You get direct access to all elements of the Std namespace. But imagine that you want to use only the std::cout or std::endl so it… 
- 
		-1 votes1 answer281 viewsChained List in C - How to implement insertion functionI am trying to implement data into a chained list. How can I do a function to enter login data, name and value into my list? typedef struct registro_st{ // sequência de objetos do mesmo tipo char… 
- 
		-1 votes1 answer106 viewsFunction problem for printing names - Chained list (C language)I’m having trouble to print out the names I am registering in this program. I’m inserting elements in a record: login, name and values. Each new element is inserted in a chain list. For example, if… 
- 
		-1 votes1 answer180 viewsRand() returning the same value even with the inclusion of srand((unsigned)time(NULL)Why the function scrolled below always returns the same values when called multiple times, although Seed srand((unsigned)time(NULL)) has been initialized? #include <time.h> #include… 
- 
		-1 votes3 answers516 viewsVariation of while with scanfWhat does this piece of code mean? while(scanf("%d", &variavelA) && variavelA ) 
- 
		-1 votes1 answer25 viewsErrors: Division by zero and iterator not dereferencableI’m having trouble compiling this code, it returns me two errors while running it: vector<bool> cp( size ); // determine crossover point (randomly) for( int i = _numberOfCrossoverPoints; i… 
- 
		-1 votes1 answer467 viewsProblem with fscanfGood night! I have a question in my second fscanf on the part of PATIENTS, because I wanted to save the date that appears in the text file (the day in a->h.d_day, the month in a->h.d_mes and… 
- 
		-1 votes1 answer61 viewsPrime numbers are not listedI’m trying to create a C program that shows all prime numbers from 1 to 100 using brute force, but my program shows nothing on the screen. #include <stdio.h> #include <stdlib.h> int… 
- 
		-1 votes1 answer805 viewsCopy string to structWhile trying to copy String nome into String in Struct novo->nome the program stops working if I comment on the function strcpy(novo->nome,nome); the code is executed normally. //Função de… 
- 
		-1 votes1 answer39 viewsYou are running the direct commands with no time to type the other notesYou’re not letting me type the rest, just typing the first one goes to the last one. #include <iostream> #include<stdio.h> int main(void) { int n1,n2,pim,rn1,rn2,rpim,rfinal; rn1=n1*4;… 
- 
		-1 votes2 answers1195 viewsHow to "break" a pure C string to assign the parts to other variables?I’m doing a thing for college and I’m lost to use C because I learned to code in Python. It’s a simple question: If I have a str string, how can I "break it" into another 3 to assign to three… 
- 
		-1 votes1 answer101 viewsCode enters infinite loopWhy is this code on loop infinite? #include <stdio.h> #include <stdlib.h> #include <conio.h> int main() { int i; float salario[10], valorDataBase, salarioReajustado[10];… 
- 
		-1 votes3 answers926 viewsPrintar Vector in CI would like to print one vector[300] and another [500], but in a way it seems to be, for the user, an array... for example, I did one of [100], where I made the loop to print this vector and an… 
- 
		-1 votes1 answer60 viewsError in vector sizeI’m having a little problem here in my code, well "everything" works normal except when I type that the struct vector size will be 2, program simply stops working. #include <stdio.h> #include… 
- 
		-1 votes1 answer60 viewsI have to take a name typed by the user and create a file with this name... LING. C#include <stdio.h> int main (){ char nome_arq[20]; printf("Digite o nome do arquivo: "); scanf("%s",&nome_arq); FILE *file; file=fopen("-------.txt","w"); fprintf(file,"huahuahuahuauh");… casked 6 years, 9 months ago Bruno Gomes 19
- 
		-1 votes2 answers299 viewsExercise in C returns wrong valueI am trying to do an exercise in C that does not generate any syntax error,I have searched and can not find the error,it simply reads or returns the wrong values. #include <stdio.h> #include… 
- 
		-1 votes1 answer58 viewsRead and print a 21-digit sequenceI want to enter a sequence of 21 numbers and save it in an array, and after that I want to print the sequence I saved in the array. This is my code: void testa_nib () { int i=0,c=0; int nib[21]; for… 
- 
		-1 votes2 answers52 viewsChained ListI’m having trouble understanding this struct pointer concept within the struct, how does it work? how endlessly stores the next element’s address? typedef struct elemento Elemento; struct elemento {… casked 6 years, 7 months ago Bruno Salazar 1
- 
		-1 votes1 answer778 viewsOpen file in CI wonder how I do to open a file in C (Open even, as if I had double-click), because the way I did, the program says that the file was opened, but it is not actually opened. If the C language can’t… 
- 
		-1 votes2 answers144 viewsOperation of function scanf()Can anyone explain to me how the function scanf() works? Not the basic, but how does the mechanism it has to return the number of arguments that were read. To whom does it return? Why does it… 
- 
		-1 votes1 answer1522 viewsHow to invert a character array in C?I have to invert a vector, example: ola = Alo. #include<stdio.h> #include<string.h> #include<bits/stdc++.h> int main() { char c[5]; scanf("%s" ,c); for(int i=5; i>=-1;i--)… 
- 
		-1 votes1 answer89 viewscheck sequence numbers visualgI have a vector q will be filled by 6 random values and need to check if there are numbers in sequence in the vector. How would you do this ? 
- 
		-1 votes1 answer192 viewsRun language file c in Python sricptI have an analog data acquisition file converted to digital values (in this case the temperature value of the LM35 sensor) with ADC Maxim 1203, I would now like to call the file in a Python script… 
- 
		-1 votes1 answer845 viewsWhat is the "->" operator for?I’m studying the linked or chained lists And I saw this operator in a code I saw I’ve searched the internet and in books and found nothing about What good is that? casked 6 years, 6 months ago Guilherme Veloso 9
- 
		-1 votes1 answer25 viewsRead and write multipas variaves with only one pointerI was successful in doing task similar to the given code: int *ptr[5], i; for(i = 0; i < 5; i++){ ptr[i] = (int *)malloc(1 * sizeof(int)); } for(i = 0; i < 5; i++){ scanf("%d", ptr[i]); }… 
- 
		-1 votes1 answer68 viewsRadix-Sort method does not work properly![.cpp has to measure and average the processing time of the implementation methods] After implementing the Radix all stopped timing the time correctly. The program asks how many numbers and how many… 
- 
		-1 votes1 answer51 viewsTable 6, what am I missing? LANGUAGE CNot giving the results, always 0 #include <stdio.h> #include <stdlib.h> #include <locale.h> main () { setlocale(LC_ALL, "Portuguese"); int i; for (i = 1; i <= 10; i++) {…