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
-
-3
votes1
answer1015
viewsHow to translate a program into C for Assembly?
How I interact between the two languages?
-
-3
votes2
answers2386
viewsHow to make the if of multiple variables with "or" work?
When I run this program, I choose the whole 1 and enter the two if's. Why are you in n==1 and in the n!=1 at the same time? #include<stdio.h> int main(){ int n; puts("ESCOLA UMA OPCAO");…
casked 8 years, 10 months ago user3903094 75 -
-3
votes1
answer156
viewsMajor algorithms of sorting?
What are the main sorting algorithms? If possible with examples in C. I don’t know when to use one or the other.
-
-3
votes1
answer113
viewsWhy don’t you want to step up?
I want to increment the cont variable if the character vector is not null, do you understand? But nothing happens. Why? #include <stdio.h> #include <stdlib.h> #include <string.h>…
-
-3
votes1
answer50
views -
-3
votes1
answer114
viewsPerformance difference between C and Matlab
Friends, I created two apparently identical encryption codes, one in C language and the other in Matlab, the code in Matlab has more functions, that is, it is more extensive and performs more…
-
-3
votes1
answer127
viewsAccentuation in C
How do I accentuate the vowels without having to use the locale library. h ? I know that the £ matches the E as it would for the other vowels ?
-
-3
votes1
answer12496
viewsConvert received value as int to char type in C
I am doing a college job in which I have to convert a received value to char so that I can write it out in full for example. Help me create this function.
-
-3
votes1
answer1185
viewsUse time. h library for dates
I wanted to use the library time.h to store a birth date type 26/10/2312 (in this format) in a given array, only I have never worked with this library. Can someone give me an explanation?…
-
-3
votes2
answers323
viewsHow to isolate higher order bits and lower order bits in C/C++?
I need to create two functions One receives an integer value and returns another one containing only the 8 bits of the lowest order of the original value, with the remaining bits set to zero. The…
-
-3
votes1
answer729
viewsBubble Sort improved
Although it has followed pseudocode correctly, the program is not ordering the array correctly. Why? #include <bits/stdc++.h> void bubbleSortM( int A[], int n ) { int i,j,aux; bool troca;…
casked 6 years, 8 months ago Carlos Ferreira 39 -
-3
votes2
answers94
viewsWhat does the expression "!(errS&errE)" do in the if?
In a piece of code I need to understand, a new syntax appeared to me on if: if (!(errS&errE)) { fprintf(stderr, "\nFALTA ARGUMENTOS\n"); if(!errS) fprintf(stderr, "-s NOME ARQUIVO SAIDA \n");…
-
-3
votes2
answers46
viewsConvert character
char converte_minusculo (char *s) // porque esta errada { int posicao = 0; while (s[posicao] != '\0') { if(s[posicao] >= 65 && s[posicao] <= 90) return s[posicao] + 32; else return…
casked 6 years, 6 months ago Edna Batista 1 -
-3
votes1
answer64
viewsHow to inactivate an element in C?
As from the following structs, would like to know how to inactivate a property. A real estate company has a set of 100 properties for rent. On each property the application must allow storing: the…
-
-3
votes2
answers45
viewsPrint subtrings recursively
I need to print substrings for a string, for example: OPEN, substrings are OPEN, OPEN, ABR, AB, A. How do I do this? 'Cause all I’m doing is printing the whole string. #include <stdio.h>…
-
-3
votes3
answers83
viewsI need to do a function that passes an n * m matrix, is transformed into a unidimesional tam n *m vector
int* Vetor_Unidim(int **matriz, int n, int m){ int *vetor = (int*)malloc((n*m)*sizeof(int)); int *p; p = *matriz; int tam = n*m; int i; for(i = 0; i<n;…
-
-3
votes2
answers88
viewsPower calculation
Make a program that receives a 200 position vector (int) Next create a function that returns the power squared of each element of the vector. The main program should display all results on the…
-
-3
votes2
answers924
viewsHow to locate a value that is in the vector but in the incorrect position?
I’m having second thoughts computaTentativas, do not know how to make the tests of if Else if Else. I need that when I find the correct number (color) in the correct position of vet[z] is tested at…
-
-3
votes1
answer134
viewsHow to convert a sequential list to a linked in C language
#define MAX 100 typedef struct dado{ int num[MAX]; int qtd; }Dados; typedef struct { Dados dados; }Lista; typedef struct no{ int numero; struct no *prox; }No typedef struct { No *cabeca; }LISTA void…
casked 5 years, 6 months ago Lourenciano 1 -
-3
votes5
answers5734
views -
-3
votes1
answer55
viewsHelp with C code
In the code below the intention was to create a vector with 10 spaces, then receive 10 values typed by the user, check if the values are equal or less than 0 and assign the value 1 in these cases,…
-
-3
votes2
answers183
viewsIs it possible to convert an integer into an Array in C or PHP?
For example: num = 5634; array[num]; array[0] = 5; array[1] = 6; array[2] = 3; array[3] = 4; I explained in a very lay way I believe, but I wanted to know if it is possible for a variable to receive…
-
-3
votes1
answer1284
viewsHow to check if user input is a negative number and display an error message?
The statement says: Write a program that reads several integer and positive numbers and calculates and shows the largest and the smallest number read. Consider that: To close the data entry, zero…
casked 6 years, 11 months ago Anderson Jesus 1 -
-3
votes1
answer93
viewsC Counter Bug - Syntax Problem
Guys, I was doing some basic programming exercises and I came across a bug that I didn’t quite understand: #include <stdio.h> #include <stdlib.h> //Program prints the odd numbers until a…
-
-3
votes1
answer75
viewsIs there any way to improve the performance of this code?
I have already found the resolution of this issue and all the results are in line with what the question asks, but I think the solution is a little slow, because it is giving Time limit exceeded…
casked 6 years, 10 months ago rafael marques 939 -
-3
votes2
answers102
viewsHow to create a function that counts the characters of a sentence and shows the frequency of one?
Context I need to create a function - using the C language - that from a sentence counts its characters and tells how many times each character appeared. Example Phrase: good proof to all Upshot: b…
casked 3 years, 10 months ago OliverQueen 1 -
-3
votes1
answer33
viewsProper fraction, improper and apparent in C language
I am trying to create the following program in C: Make a program that receives 2 numbers referring to the numerator and denominator of a fraction and inform if it is a fraction of its own, improper,…
-
-3
votes3
answers68
viewsprint a variable int in C
I’m in need of some help. want to print the value of an int variable decided by scanf, but when I compile and run the program it returns me the following value: "type the value of A -->11 the…
-
-3
votes1
answer51
viewsHow to replace Python Len in C
How do we make this work? In case, I’m trying to use a "for" for the counter at each value entered in the while to increase by 1 (to calculate the average correctly). This could be solved in Python…
casked 3 years, 8 months ago Semaguinho 1 -
-3
votes2
answers76
viewsEven Number Counting (c language)
I need to display on the screen the numbers between a typed initial and final value, after which write how many are pairs. ex. 2 and 10 will display on screen: 2, 3, 4, 5, 6, 7 ,8 ,9, 10. then tell…
-
-3
votes1
answer30
viewsStart a vector within a struct
Good afternoon. I wish to start a vector of integers within a struct, but I am accusing you that you need a ";". Follow the image. Note: it is not the comma dps of the last zero the problem, because…
casked 3 years, 3 months ago Ryan Kologeski 1 -
-3
votes0
answers28
viewsCan someone please help me create a C program that manages the value 0 or 1 once and store it in a variable
Someone can help create a C program that generates the value 0 or 1, once and store it in a variable. I tried to do it but it didn’t turn out the way I’d hoped: #include <stdlib.h> #include…
casked 3 years, 3 months ago Uzzoper Fortnite 1 -
-3
votes1
answer471
viewsCalculator in C (Beginner)
I have a question in the following exercise: Create a program that takes two whole numbers and shows the result of division of numbers and their rest. the program should ask if the user intends to…
casked 6 years, 6 months ago ErmesonMartins Oliveira 15 -
-3
votes1
answer279
viewsError returning items not repeated and in alphabetical order
The code is in the image. Statement: "Valentina is a very dedicated woman and usually works late every day. To save time, she makes the shopping list of the market in an app and usually notes down…
casked 6 years, 1 month ago Stéphanie Morterá 1 -
-3
votes1
answer59
viewsWhat flag could I use to stop the execution of the ler_disciplinas function?
#include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct materias { char disciplinas[20]; char semana[7][15]; }materias; void ler_disciplinas (); int main(){…
-
-3
votes2
answers90
viewsI’m not getting C. Please help me!
I’m looking to make an ATM with only 10 notes, with a limit of 1000 ballots. However, you have to show me how many ballots are in the box and how much is left to remove, and that it is possible to…
-
-3
votes3
answers167
viewsWhat’s wrong with the Bubble Sort algorithm?
I’m creating a code with the algorithm Bubble Sort, but when compiling I get errors, which are: In function 'int main()': 16 33 [Error] cannot convert 'int*' to 'int**' for argument '1' to 'int…
casked 5 years, 5 months ago rebel_vitor 9 -
-3
votes1
answer153
viewsI’m having trouble with my C algorithm
I created a calculator: include stdio.h include stdlib.h include locale.h int main(void){ system("color 0a"); float num1, num2; char op; setlocale(LC_ALL, "portuguese"); while(1){…
casked 5 years, 4 months ago Lucas Silva Dias 1 -
-3
votes1
answer40
viewsHelp on a While Improvement()
I would like when the user presses a different character from’S' and 'N', to inform the message "Enter a valid character". They could help me? #include <stdio.h> #include <stdlib.h>…
-
-3
votes1
answer70
viewsI need you to help me with this issue in C
I have a question about my code. I think my logic is correct, however, the change in $1.00R notes is not working properly. Any suggestions? #include <stdio.h> int main() { int valor_produto =…
casked 4 years, 7 months ago Kennia Taisa 1 -
-3
votes1
answer135
viewsHow to generate a Boolean (0|1) randomly given the probability of the truth event in C?
I am trying to create a function for a larger problem, and only the function has the following description: returns a non-null integer with probability f, and returns 0 with probability 1 f, where 0…
-
-3
votes1
answer38
viewsHow to duplicate a struct in "C"
I have an activity that is to create a struct with SIZE = 5 initially, but I would like it to double its value if it is necessary to insert a sixth value, created a return function for this but the…
-
-3
votes1
answer35
viewsI’m not getting a piece of code into a c-function, can you help me please I’m new to this business
Problem 3: Make a function that receives, as a parameter, a vector with ten integers and return them ordered in increasing form. The code I’m using: #include <stdio.h> int main(){ int i,…
casked 4 years, 5 months ago marcos rodio 1 -
-3
votes1
answer76
viewsProgram to list prime numbers less than or equal to the input value
Good morning, I want to print a set to which I must print only the primes smaller or equal to the input value, but I cannot succeed, because it always returns the value n and n-1, with the exception…
-
-3
votes1
answer107
viewsC number of approved students failed
Please, I need the total amount of failed and substitute students approved program Elaborate program C to calculate and display the average of 3 students in a given discipline. The simple arithmetic…
-
-3
votes1
answer39
viewsProblem with a counter adding numbers inserted in C
I have to read 6 values and then show how many of these typed values were positive. On the next line, you should show the average of all positive values typed, with one digit after the decimal…
casked 3 years, 9 months ago lucas.lucena 1 -
-3
votes1
answer107
viewsI’m doing a C program, which consists of implementing the Lagrange interpolation method
I’m doing a C program, which consists of implementing the Lagrange interpolation method. Where the user enters the table data (values of x and fx, and I have to return the value of lx and px, only…
-
-3
votes1
answer98
viewsJOKENPO game can only end when player or computer win 3 matches
Good people, I directed the game Jokenpo but I did not take this phrase "The challenge is to create a game with better than 3 rounds, IE, the game can only end when the player or the computer wins 3…
casked 3 years, 8 months ago Lucas Gonzales 3 -
-3
votes1
answer62
viewsProblem with switch case inside for loop
I need help with my code with switch case inside for loop. I’m a beginner in programming and I don’t understand why the loop doesn’t run as desired. The desired would be to run the printfs before…
-
-3
votes1
answer30
viewsInvalid conversion when using pointers (invalid Conversion from 'int**' to 'int' [-fpermissive])
I am learning about pointers and dynamic allocation and I cannot overcome this bug. Apparently the pointer is not accepting the value of type int, but I cannot understand why this occurs. #include…