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
votes2
answers580
viewsStruct with pointer and allocation
I can’t use the fscanf in a structure, I have already allotted the structures. #include <stdlib.h> #include <stdio.h> #include <string.h> struct Cliente { int numero; char *nome;…
-
1
votes1
answer12458
viewsDevc++ returns "uncompiled source file". Why?
I can compile the file quietly only when I run it presents the source file not compiled. Could anyone help me? #include <stdio.h> #include <stdlib.h> #include <conio.h> int main ()…
-
1
votes1
answer895
viewsProblem with "Double" on my calculator I made in "C" language
I was making a simple "C" calculator just to exercise logic, which I learned and for fun, but I had problems , since I would like to turn it into a scientific calculator, Float can use, so I tried…
-
1
votes1
answer241
viewsProcess Synchronization (Fork) - "Segmentation fault"
I am trying to create 3 processes and use semaphore on them. The code below compiles, but in the middle of the execution there is an error called "Segmentation fault". I don’t know how to solve…
-
1
votes2
answers65
viewsFopen typecast for comparison with NULL
When I make a fopen, I always use an if for error correction. The pointers are declared in FILE *mestre, *indice; And I’m wearing it like this if (((mestre =…
casked 10 years, 5 months ago Vitor Figueredo 209 -
1
votes1
answer96
viewsAuto benchmarking with moon
A script in C or C++ could write algorithms in Lua (by Brut force, that is, test several possible combinations) based on a database with the results of the algorithms. The idea is to get to the most…
-
1
votes1
answer255
viewsVector mean of prime number indices
Well, this is the problem. I thought here and arrived at a code. However, both the sum and the k (which would be the prime number positions) are incorrect. Any idea why? #include <stdio.h>…
-
1
votes2
answers1700
viewsHow to put images on the screen?
In MSX, you used BASIC to put an image on the screen without going out of command line mode. Today, we can’t do this anymore? Without using Opengl or other Apis, how do we place pixels on the…
-
1
votes1
answer118
viewsError while reading characters
Instead of the code reading the three char variables, it reads 2 and prints the first. #include <stdio.h> int main() { char ch1, ch2, ch3; puts("Digite 3 caracteres, um apos o outro:");…
casked 10 years, 4 months ago Wellington Viana 196 -
1
votes2
answers344
viewslink factoring
I am stubbing the book 6th edition of C as programming of the Deitel brothers and I am doubtful in an exercise, the exercise is the 4.14 of chapter 4 which is about factorization, it asks a program…
casked 10 years, 4 months ago Leonardo V. De Gasperin 713 -
1
votes2
answers1183
viewsSum of squares
I’ve been doing a function to compute the sum of the first number (x0) with the ratio (r) by multiplying by a number (n) of times, like this function: double sum_arithmetic(double x0, double r, int…
casked 10 years, 2 months ago Bruno Rodrigues 135 -
1
votes2
answers114
viewscho-han bakuchi in basic C
I am having a doubt in the program I made to represent the game cho-han bakuchi, this game has as a rule to roll two dice of 6 sides in a cup before to show the dice if it makes the bet in which the…
-
1
votes1
answer331
viewsDouble with a maximum accuracy of 40 digits
I need my program to return a high number of digits in the house up to 40 digits. I saw that guy DOUBLE has a range of 1.7 X 10 -308 to 1.7X10 308, so I must think that it meets, even too, my needs.…
-
1
votes1
answer1184
viewsmatrix multiplication with minimum maximum of each line
hello I made a program in order to multiply each element of each row of an array by its highest value element, but my program multiplies each one by itself #include <stdio.h> #include…
casked 10 years, 3 months ago Leonardo V. De Gasperin 713 -
1
votes1
answer83
viewserror when comparing C-torque
I have a Perl program that connects to a socket, receives binaries in this socket, reads the incoming binaries, compares them with other binaries in a buffer so I know if there are these binaries in…
-
1
votes1
answer250
viewsPermission denied accessing file
I have a function in my program where it shows all students registered in a binary file, the user selects which one he wants to delete, a confirmation screen appears with the user’s data waiting for…
-
1
votes1
answer62
viewsHow to allow the user to select a directory/folder using a Filechooserdialog?
Maybe you can add a directory filter to achieve this.
-
1
votes1
answer324
viewsHow to pass a function pointer by parameter?
I need it passed through argv[], in the main function, the name of a function that will be called by the same. I can’t make comparisons of strings, then I must make the call with variables. Here is…
-
1
votes1
answer2518
viewsCreate function that returns random numbers in C
I need to create a function that returns random numbers without repetition between 2 intervals. I wanted to create a kind of a card game, where the cards are shuffled, and when they return they…
-
1
votes2
answers84
viewsHow does the compiler work in the case of a casting like this?
Having the code to follow: 0 #include<stdio.h> 1 2 int 3 main(void) 4 { 5 int x; 6 x = -3; 7 8 for (int i = 0; i < 5; i++) 9 { 10 printf("%d\n", (unsigned int) (x - i)); //necessita mesmo…
-
1
votes1
answer232
viewsReading file in Objective C
I’m trying to read a file on. c, I can read everything right there but in the variable it returns me a whole content and a " n" that harms the rest of my code. Below is the section that performs the…
-
1
votes1
answer361
viewsfunction in Graphics. h
I’m trying to learn a little more from C/C++ libraries to do more things so I went after the Graphics library. and went after the most basic code I found, which was: #include <graphics.h> int…
-
1
votes2
answers352
viewsSegmentation failure in malloc() function
I am having a segmentation fault error when I have imploded a dynamical array of pointers to be able to store the contents of a row-by-row file. size_t file_mem_init(char ***ptr,FILE * file){ size_t…
-
1
votes1
answer1440
viewsRecursive function to end a list
I want to do a recursive function to offset the memory of each block in the list, but when I print it after using the function, it loops and memory addresses are printed when asked to print (the…
-
1
votes3
answers2790
viewsRead a string with line break
I need to compare two strings to see if they are equal. One of them is in a vector of struct and was dealt with the fgets, so it’s a line break. The other one is informed by the keyboard. I wonder…
-
1
votes2
answers115
viewsSegmentation Fault in Structs C array
I’m trying to make an array of dynamic structs in C, but I don’t understand why it’s returning to me. The code is basically this: I’m just creating a vector of 10 arrays and then trying to…
-
1
votes1
answer1328
viewsString with memory junk
I’m having some problems working with files and functions, the code I’m making should print a string in the file, but this string is littered, and does not print out what should be used despite…
-
1
votes1
answer562
viewsHow to adjust the format dd/mm/yyyy
I have the following code that takes the instant date from the computer. #include <Windows.h> #include <stdio.h> #include <time.h> void main () { time_t t = time(NULL); struct tm…
-
1
votes1
answer115
viewsC portability on Linux
I’m starting to use the Compile and there they use Linux. I’m having some problems such as printing a text file. Check my program, it works on windows: #include<stdio.h> /* escreva um programa…
-
1
votes2
answers420
viewsHow to remove a variable from memory?
How to remove a variable, not necessarily from the code, but from the memory/record, in C? Hypothetical example: char meu_byte; //codigo deleta_da_memoria(meu_byte); That generates something like:…
-
1
votes1
answer581
viewsMQL4 language (BUY and SELL orders)
someone has knowledge of this language "MQL4", it is based on C and is used particularly by a stock exchange quotation program. If anyone knows, my question is the following: How do I make BUY and…
-
1
votes1
answer79
viewsPassing address to Writeprocessmemory
I’m trying to pass a memory address to WriteProcessMemory(), only that this address should be typed by the user, I am in doubt of how I can do this, I tried with strings, wstring, did not succeed.…
-
1
votes2
answers1138
viewsIs there an Interpreter for C?
I would like to test small chunks of C code in the same way I can with Python, opening the terminal and testing command by command, this would be possible with c?…
-
1
votes1
answer288
viewsReset pointer address after being incremented several times
I have the following code #include <stdio.h> #define T_INT 5 int main(int argc, char *argv[]) { int v[T_INT],i; int *p = &v; /* Preenchendo o vetor*/ for (i=0;i<T_INT;i++){ v[i] = i; }…
casked 9 years, 9 months ago Isvaldo Fernandes 1,690 -
1
votes1
answer756
viewsChanging integer array to image filter
I’m making a program that applies filters to images .ppm, images without any encoding, the problem is that when I apply the filters, the original image is not changing, where is my error? The same…
-
1
votes1
answer2935
viewsSort Char vector in C using selection method
I am trying to sort a char vector using the selection method (Seletion Sort), but it is returning me the vector exactly the same way, without even making a change. Can someone point me to the error…
-
1
votes1
answer2508
viewsHow to compile and run C program using Sublime Text on Ubuntu 12.04?
You can configure Sublime Text 2 so that it will embed a C code and then run and show the result in the terminal?
-
1
votes1
answer2424
viewsRead file in binary
Hi, I am saving a file in binary format and trying to open the same binary. However, I am not getting the expected result. They follow the writing and reading function. I’m saving a format image.…
-
1
votes1
answer231
viewsProblem with delta output<0
Good evening, I am having trouble with the output of my program which printed on the screen the roots of the second degree equation. When I go to the condition of: if (delta<0) //Condicao caso o…
casked 9 years, 8 months ago Gabriel Vinicius 339 -
1
votes2
answers728
viewsASCII encryption in C
I need help with that, I’ve done the functions that encryption and decryption, it encrypts normal, however, at the time of decryption it sure does not do the process properly. The error and the…
-
1
votes1
answer3017
viewsCopy struct C
How do I copy a pointer of the type struct in C? For example, to copy a simple struct is just struct1 = struct2; but, when it comes to 2 pointers, when it does this, one points to the same place as…
casked 9 years, 8 months ago Marcelo Gouveia 13 -
1
votes1
answer784
viewsDismember full numerical expression in C
Hello; I have a code that should be done in the C language, which is to receive a numerical expression, including the result of it, for example: "20+30=50", which will be stored in a string. After…
-
1
votes2
answers155
viewsUndefined Ference to MIN
When compiling my media program with discard, the following error occurs. Remembering that I used the MIN to rule out the lowest value between a, b, c and d. My program. c:(.text+0x8b): Undefined…
-
1
votes1
answer5855
viewsPointer of struct inside a struct
I cannot assign value to a variable of a pointer struct within a struct. My structs: typedef struct notas{ float geral; float especifica; }Notas; typedef struct data{ int dia,mes,ano; }Data; typedef…
-
1
votes2
answers634
views -
1
votes2
answers145
viewsprintf does not show the expected value
I’m having trouble showing off some printf, for example: printf("\nDigite as horas : %d"); And at the time of displaying the message, it appears with a number on the side, for example: Enter the…
-
1
votes2
answers326
viewsSegmentation failure when changing a Struct’s value in C
An error is occurring Falha de segmentação when trying to access information from a struct. The code is as follows: #include <stdio.h> #include <stdlib.h> typedef struct { int val;…
-
1
votes2
answers194
viewsSegmentation fault: Linked lists in C
I’m playing a little C here and I found that in the second insertion I do through the console that the lista loses the first pointer(pointer) created in the first insertion creating a Segmentation…
-
1
votes1
answer426
viewsInsert sub-list C
Hello, I’m having a hard time working with chained sublists. I would like to know the correct way to insert a sublist in a list. I have declared the lists as follows:: struct Casa { int…
-
1
votes1
answer353
viewsUndeclared variable
You’re making a mistake on lines 118,127,133,139... 127 20 'vector' was not declared in this Scope #include<stdio.h> #include <stdlib.h> #include <string.h> #define tamanho 5 int…