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
answer156
viewsSegmentation Fault and Error in typedef struct
Hello, I’m developing a final work of a discipline and I’m getting two mistakes I don’t understand. First here’s the code. #include <stdio.h> #include <stdlib.h> int main(int argc, char…
casked 10 years, 5 months ago Vitor Figueredo 209 -
0
votes1
answer4146
viewsStock and sales control
Hello, this progrgrama is a stock control, what he asks this in the first printf of the program, a stock and sale controller only with struct. Cases 3 and 4 are in trouble, because I can’t get…
-
0
votes2
answers576
viewsFscanf, fprintf and printf
I have a problem with reading and showing on screen. The program it read from the keyboard a series of data, save them in a binary file and then allow the query of how this information is in the bin…
casked 10 years, 5 months ago Vitor Figueredo 209 -
0
votes1
answer102
viewsC programming error, how to make it work
#include <C:\Users\Rosangela\Desktop\exercicios\bibliotecaFuncao.h> #include<stdio.h> #include<string.h> void paraBaixo(char *nome) { int i; …
-
0
votes1
answer3045
viewsHow to develop a basic game using opengl that accepts keyboard commands
I tried to follow the source of a tutorial Metar Gearn Nanna, because I was interested in creating a game in opengl and c++, it could be something simple, with precarious validations, just to…
-
0
votes1
answer719
viewsC print name with scanf
I have the following code, the problem is that it returns string2 as '(null)'. How do I fix? and why does this happen? #include <stdio.h> int main() { char *string; char *string2;…
-
0
votes1
answer224
viewsError reading %f and %e from a file in C
In the following excerpt of my code I have to read a function of a txt file and extract its coefficients. When I set the coefficients as integers and read them with %d works correctly, but when…
-
0
votes1
answer284
viewsInitial end term of the Fibonacci sequence (closed interval)
I have to make a list of exercises in C and Java, but I could not understand the logic in this exercise. Could someone help? Ask the user for the initial and final Fibonacci sequence term (closed…
-
0
votes2
answers148
viewsCode refactoring in C
I was trying today to create a simple program and C with some colleagues and one of the questions was: No else if it would really be necessary to put the validations precoAtual >= 30 and…
-
0
votes2
answers3362
viewsdoubts intercalation of vectors in C
hello, I have a problem here with vectors I would like to know what is going wrong and I am having difficulties, if anyone can help me on this. #include <stdio.h> #include <stdlib.h> int…
casked 10 years, 3 months ago Leonardo V. De Gasperin 713 -
0
votes1
answer457
viewsMatrix multiplication in C
I have a little problem with this show, i need in a matrix[4][4] to find the minimum maximum of each line and multiply by each number of the line, in my program it has a syntax error, because I keep…
casked 10 years, 3 months ago Leonardo V. De Gasperin 713 -
0
votes1
answer83
viewsError copy file in C language
Hi! I’m trying to create a copy of a C file, but I’m not able to copy the content, it’s just creating a new blank file, can anyone see where I’m going wrong? #include <stdio.h> int main() {…
-
0
votes1
answer1004
viewsHow to check winner in the game of old
I’m playing an old-fashioned game on C, I want to know how to check which player won by checking the lines horizontally and vertically and on the diagonals. Here’s my program done so far: #define…
-
0
votes1
answer2993
viewsConvert C++ to C#
Well, I’m passing some codes I have, and I’m doubtful I can pass that code to c, and I’d like help from anyone who can help, in the following code below #include <dirent.h> #include…
-
0
votes2
answers1770
viewsSort a struct
Do you have any way of ordering a struct in the form: struct cidadecoord { char cidade[90]; int coordx, coordy; }cidades[N]; N is worth 30 in the case, and I would like to order x and y coordinates,…
-
0
votes2
answers98
viewsCan I put an array as a parameter for another array?
for(i=0; i<=203; i++){ array2[3][i]; array1[array2][2][string]; /*string corresponde a uma string ja definida e nao relevante para a questao*/ (...) …
-
0
votes1
answer10434
viewsReplace a string character with an asterisk
The question is as follows: Make a program that reads a text (string) typed by the user with a maximum of 500 characters. Print this text by replacing the first letter of each word with an asterisk…
-
0
votes1
answer652
viewsFraction sequence with Fibonacci and primes
h. Ask the user for the amount of terms he wants and print the sequence below and the sum of terms. 1 + 1 + 2 + 3 + 5 + 8 +… 2 3 5 7 11 13 * above Fibonacci sequence and below Primes sequence. I…
-
0
votes1
answer3158
viewsUnknown error type name
I’m trying to pass a typedef struct as a parameter to a function, but it gives the error: "Bib. h:6:13: error: Unknown type name 'matrix'" Here is the code: #include "bib.h" typedef struct { int…
casked 9 years, 11 months ago user3741052 87 -
0
votes2
answers75
viewsProblems in passing arguments by parameter
I’m having trouble passing arguments through parameters. The error occurs in the row 23 column 5 and it’s like this: Too few Arguments to Function 'imc' #include<stdio.h>…
casked 10 years, 1 month ago Leonardo V. De Gasperin 713 -
0
votes0
answers71
viewsHash Table for text word incidence
This problem was best illustrated here: Error in vector copy of structured type Summary: I am developing an index dictionary, which stores the incidence of a word of text (input) using a hash table…
-
0
votes2
answers2323
viewsC problem reading file and writing to vectors/matrices
I’m having trouble reading data from a file and writing it into a vector and matrix. I can’t give the printf to test them. So I’m not sure if the code is correct. The file has student names and…
-
0
votes1
answer183
viewsError in vector copy of structured type
Error copying elements from a vector of structured type to another vector of the same kind: At the end of the code below, I use a function to "print" all elements of the tabela2 (vector that will…
-
0
votes1
answer478
viewsParameters of the exec function
I was doing an exercise of a book and in it has the following order: Looking at the function parameters exec: Function exec It does not talk about any parameter that can be passed to inform how many…
casked 9 years, 9 months ago Rodolfo Oliveira 917 -
0
votes1
answer64
viewsProblem in the supply function
I’m here with a problem in this role int supre (char S1[ ], char s2[ ]) , which calculates the size of the largest S1 suffix prefix of s2. For example if you have supplied ("cheat", "totality") you…
-
0
votes0
answers38
viewsSudoku demonstration in C
I’m making a Sudoku that the computer plays, I already have all the logic programmed, but I can’t print the answer in the file and on the screen, if someone can take a look and tested in my code I…
casked 10 years ago Leonardo V. De Gasperin 713 -
0
votes2
answers1648
viewsBubble Sort matrix, bi dimensional vector
I’m having trouble creating a Bubble Sort order a square matrix. Simple vector I get, the problem eh with matrix. I tested several ways and nothing. At the moment I am in the following…
-
0
votes1
answer56
viewsStream corrupting to be saved
I have the algorithm that simulates a type of registration, but when I save the file the fields, street, city and state are lost, simply disappear, and as I am saving it corrupts the file already at…
-
0
votes1
answer2130
viewsXY position in C, repositioning
I am in need of the current "cursor" coordinates of the screen, for the user to remain in the current line. EXAMPLE void main{ char nome[50]; char sobrenome[50]; int linhaAtual; linhaAtual = ????;…
-
0
votes2
answers4930
viewsTriangular number
I wonder, why when I type in the program below that checks if the typed number is triangular, ie, is multiple of three consecutive numbers, as example 60 it prints two "NO" and a "YES", and when…
casked 9 years, 7 months ago Gabriel Vinicius 339 -
0
votes1
answer495
viewsDifficulty with triangular number program
I’m having trouble creating a program that prints whether the number typed is triangular or not. How should I proceed to create within the conditional an undefined sequence for a large number?…
casked 9 years, 7 months ago Gabriel Vinicius 339 -
0
votes3
answers2209
viewsmap in C works?
I would like to know if it is possible to use map in C. I know it works in C++, but in C it always gives build error. If someone has already used map in C, it could show me how to use? #include…
-
0
votes1
answer55
viewsStoring information about students
I need to develop a program platform WINDOWS where it will be stored information about students of the kind: age, gang, shift and name. The program must also contain a search for name. I would like…
-
0
votes1
answer894
viewsWrite to a 2x16 LCD display with the MCU 8051 IDE on-line c
I wanted to write a few words on a 2x16 LCD Display, I already have the code I’m going to expose here, but I don’t know why this gives me a mistake: HD44780 ERROR: Neither 'Set DDRAM ADDRESS' nor…
-
0
votes2
answers157
views -
0
votes2
answers1917
viewsHow to Show all elements of an array declared in a C struct?
In that code: #include <stdio.h> #include <stdlib.h> struct cadastro { char nome[50]; int idade; char rua[50]; int numero; }; int main() { struct cadastro c[4]; //Array[4] de estruturas…
-
0
votes1
answer675
viewsHow to Collide 2D from C++ Tiles
Hello. I wonder how I can get collision of Tiles in C++. I am using an engine made by my friend, even so, I would like to know how to do. I’m using SDL 2! Grateful from now on Thiago…
-
0
votes1
answer9872
viewsError : subscripted value is neither array nor Pointer nor vector
Hello, good afternoon, I’m trying to get the values that are in my matrix in the function, but this giving this problem:1:19: error: subscripted value is neither array nor Pointer nor vector Below…
casked 9 years, 5 months ago Gabriel Vinicius 23 -
0
votes2
answers1725
viewsPrint the largest N notes and names among the values that are in the struct array
Hello, I would like some help here, more specifically in case 4 if. I would like some solution without having to order the vector. Grateful. #include <iostream> #include <cstdlib>…
-
0
votes1
answer205
viewsHow to get the value of a memory variable?
I course the first period of CC and would like to know how I could achieve variable value of a game, for example, in real time. For example, when a boolean variable changes the value to TRUE, I…
-
0
votes1
answer1280
viewsproblems with 'Multiple Definition of...' in files. The
Hello, I am doing a program to study lists and I am having a problem with the definitions of functions, I tried to solve with my data structures teacher but I could not understand right, if anyone…
casked 9 years, 5 months ago Leonardo V. De Gasperin 713 -
0
votes1
answer3252
viewsC - Concatenate char (Not STRCAT)
I have 2 variables: char x[100] and char c; At first, I had to store c inside x. I did it this way: x[0] = c; Inside my program, after the previous run, the variable c value changes. Then I need to…
-
0
votes2
answers334
viewsC: Use two gets() in a row (player names)?
I’m trying to play a little game, so I displayed a menu and then I used the command switch to access the options, in case the user wants to play he selects 1 and will be asked to him the name of…
-
0
votes2
answers447
viewsHow to make a matrix sum using shared memory?
I need help to perform a sum of matrices using shared memory. #define LINHAS 3 #define COLUNAS 3 #define PULAR_LINHA printf("\n") int main(int argc, char *argv[]) { int linha, coluna; //indices int…
-
0
votes2
answers52
viewsWhy is one of the cases incorrect?
Good evening, I wonder, why my code return a wrong value for a case in which the input is 1.1 and 100000, the output should give 100000 and 5000050000 and this giving 100000 and 705082704?? the…
casked 9 years, 7 months ago Gabriel Vinicius 339 -
0
votes2
answers335
viewsGood graphical library for beginners?
Well, I know that in stackoverflow I shouldn’t get too caught up in the subjective when it comes to questions, so I’d like you to answer them based on facts and not based on your experience. Well…
casked 9 years, 5 months ago krystalgamer 531 -
0
votes1
answer904
viewsProgram in C where you have to remove a student from a vector
I have to make a college program that remove a student from a vector, that when I run the code below, it excludes the student but leaves a special character in the code, can help me? //Remover o…
casked 9 years, 7 months ago rafaelbertoco 15 -
0
votes1
answer55
viewsError not filling in program fields
I created a program in Visualstudio that uses 4 Textbox, and when I do not put anything in the 4 Textbox and then click on the button that adds what is inside the 4 Textbox the error program, how…
-
0
votes1
answer395
viewsGo through 4x4 matrix with for, I don’t understand
I don’t understand that code: #include <stdio.h> #include <stdlib.h> int main() { int i, j; for(i=1; i<5; i++) { for(j=1; j<5; j++) { if(i==j) printf("1 "); else printf("0 "); }…
-
0
votes2
answers1482
viewsHow can I complete the harmonic mean?
I wonder why my code is not returning the correct values, because when I type the value it does not calculate correctly, how to enter with two notes, both valid 5.0 and 5.0, the exit should be 5.0…