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
answer102
viewsRecursion and sum
I am making a program in which you need a recursion according to the exercise that sums a vector of two matrices and sums the rows after the recursion and then add the columns to my code #include…
-
1
votes1
answer229
viewsSegmentation fault (core dumped)
There is something wrong with the pointer in this program, which aims to test a function that counts the number of characters in a string. For some reason he can’t access the memory he points to.…
casked 8 years, 8 months ago Jefferson Carvalho 726 -
1
votes1
answer665
viewsHow to add counter to every if of my simple code
#include <stdio.h> #include <stdlib.h> int main() { float x,y; char k; do{ printf("Este Programa indica o quadrante no plano cartesiano\n"); printf("Entre com o valor de x:");…
-
1
votes1
answer1306
viewsExercise URI 1005: Code correction C (simple average)
QUESTION: When I typed my code in the URI it returned "Wrong Answer (60%)". Below is the description of the exercise and the code entered. What is missing? What code? My code: double A, B, MEDIA;…
-
1
votes2
answers287
viewsHow to make a function use how many arguments are provided to it
Is there any way to make a function use multiple arguments without their declaration? For example: #import<stdio.h> #import"rlutil.h" //para as cores void a(color,string){ setColor(color);…
-
1
votes1
answer1109
viewsVector return and matrix of a function in c!
The problem I’m having is that my serial pointer is all null, and the rest of the code runs good, I really can’t find what the problem is! If anyone can help me I appreciate it already!! Obs.: There…
casked 8 years, 7 months ago Guilherme Gehlen 11 -
1
votes1
answer128
viewsTroublesome socket response on Android NDK
I’m trying to implement this library, Parson, in C, but when I try to manipulate the data obtained via connection socket(ONLY link), I get a null, what doesn’t happen when I manually put the json in…
-
1
votes1
answer324
viewsProblem with reading Bitmaps in C
I’m having trouble reading files Bitmap. Results not as expected. The size is always the same regardless of which image I open Height and width do not match the size stated in the image viewer The…
-
1
votes1
answer309
viewsI have a bug in the scanf
I have to read N lines with one of the following 3 formats: "P k": the letter P followed by k being k an integer number; "A k": the letter To followed by k being k an integer number; "Q": the letter…
-
1
votes1
answer337
viewsError importing structs from a header file
I need to use the following structures without changing their file implementations .h. typedef unsigned long int chave_t; typedef unsigned long int conteudo_t; typedef struct entrada_hash{ chave_t…
-
1
votes0
answers51
viewsChange contents in a given position in a multidimensional array within a structure
I’m having trouble modifying the content in a given position of a multidimensional array that is within a structure. I have two structures struct TabelaFilial and struct ArrTabela. The structure…
-
1
votes1
answer79
viewsHow does the data types after constant work in C?
I’m reading some codes and came across the following code #define foo unsigned int #define i typedef i know how this unsigned and Signed, typedef etc works, but I’m not getting to understand how…
-
1
votes1
answer153
viewsPass C struct to lua script
When I got past my frame Book to the script in Moon, the method writes the value as nil. How I pass the structure Book to my moon code? main. c: #include <lua.h> #include <lualib.h>…
-
1
votes1
answer112
views -
1
votes3
answers399
viewsDoubt about C pointers
void imprime (char *v, int n) { char *c; for (c = v; c < v + n; v++) printf ("%c", *c); } I have this function, but I don’t understand what exactly she’s doing and how the pointers behave in this…
-
1
votes1
answer1787
viewsHow to create multiple . txt files?
How do I create multiple . txt files in c/c++ ? I have that function: tocopy(){ FILE *file = fopen("Teste.txt", "w"); fclose(file); } But it only creates a Test.txt file…
-
1
votes1
answer334
viewsOperator & and * in functions
What is the meaning of this & in front of the matrix (my function only works with &, I am overloading Cout<<(matriz1 + matriz2)) And the meaning also of the * in front of the void?!…
-
1
votes1
answer151
viewsFunction that reads a double of a string and returns the rest of the string in C
Is there any function of the type? Which reads and stores or returns a double of a string and returns or pointers the rest of the string or do I have to do my own function? If there is no one have…
-
1
votes2
answers350
viewsDoubt in string, and comparison
I am doubtful in the following exercise: Write a C program that receives two strings via standard input and whether the second string is contained in the first string, i.e., if the second string is…
-
1
votes1
answer1037
viewsDoubt about Caesar’s cipher
The problem is that I need to stop printing when it reaches the last digit of the vector only I don’t know how to do, and also how I will print after z, because the way I did it didn’t print ? ( I’m…
-
1
votes1
answer818
viewsDifference between void and void*
What is the difference between void* and void as type of return of a function? Example 1: void *func_nome(int param){ ... } Example 2: void func_nome(int param){ ... }…
-
1
votes5
answers210
viewsVariable is not displaying the expected result
On reading the variable at the end to display the value, displays a trash, here is the statement along with my code. Make a program that receives the age, height and weight of five people, calculate…
-
1
votes1
answer175
viewsWhat is the increment on a pointer for?
Datum: #include <stdio.h> int main () { int x = 1; x++; int *y = &x; y = y + 1; printf("%d\n",x ); } The exit is 2. In that case I would like to know if the following interpretation is…
-
1
votes1
answer176
viewsError accessing string array
I have the following code: #include <stdio.h> #include<stdlib.h> #include<string.h> int main() { char v[]= {'Brasil', 'Alemanha', Japão'}; int i = 0; for (i=0; i<4; i++){…
-
1
votes1
answer102
viewsA comparison between 2 char(s) is wrong
I’m manipulating a string with a loop for... which generates a new string of the same, starting and ending from a certain position (would be "Hello" in that case). When comparing the return of the…
-
1
votes1
answer34
viewsst_gid and I-Node with different values within the stat structure
I’m trying to build a program within the function stat that shows the value of inode and the value of gid. Follows the code: #include <stdio.h> #include <sys/types.h #include…
-
1
votes1
answer1521
viewsComparison of vectors in C
I’m currently trying to establish a comparison of two vectors in C. My code structure is as follows:: int iguais(int *v1, int *v2, int tam) { int i, cont = 1; for(i=0; i<tam; i++) { while(*(v1 +…
-
1
votes1
answer46
viewsStandard input and output (using C programs)
I have a program that prints something, and another that reads something and prints another, I wonder if it has how to connect the output of one with the input of another. The gambit I did was, pass…
-
1
votes1
answer75
viewsRun ruby script in C
The error code when running the script in ruby. file.Rb: #!/usr/bin/env ruby x=1 while x<10 puts "It Work!" x+=1 end main. c: #include <ruby-2.0.0/ruby.h> int main(int argc, char **argv){…
-
1
votes2
answers345
viewsFWRITE function is not writing in binary format in C language
I am not able to write data in binary in a file using the C language. Even using 'Wb' the output of the file are characters. How can I proceed? Here’s part of my code: void cadastrar(void) {…
-
1
votes1
answer59790
viewshow to use the POW (POTENCY) function in C
Good afternoon guys, I’ve come this far. #include <stdio.h> #include <math.h> int main(void) { float val_carro, juros_mensal = juros_mensal / 100, num_parcelas, cf; printf("\n\n Digite o…
-
1
votes1
answer317
viewsHelp with C nested structs
I was creating in C a list and using a struct, after finishing I tried to see what changed with a struct nestled, created two structs basic, one receiving only one value and another receiving this…
-
1
votes2
answers74
viewsVector that generates elements
I would like to generate a vector where your next position element is added to 1. For example: be a vetor[3], would like that v[0] = 1 and v[1] = v[0] + 1, v[2] = v[1] + 1 and so on. How would you…
-
1
votes1
answer43
viewsSimple While Cycles
#include <stdio.h> main(){ int cont=15; while(cont<=200){ printf("%d\n",&cont); cont++; } } Supposedly the counter should start with the value 15 and go showing its value by adding 1 at…
-
1
votes1
answer726
viewsDifference between recv and read, send and write
I am transmitting and collecting data from a connection using Sockets, to send the data to the server, you can use the commands send and write, and to receive the data recv and read. There is a…
-
1
votes1
answer259
viewsError when compiling a modularized program in c
I made a program in which reads strings from a file separated by - (hyphen) and saves each string at a position of a struct vector. When compiling, generates the following error message: array type…
-
1
votes2
answers365
viewsConvert Header C/C++ to Delphi
The intention is to consume a dll of biometrics http://www.veridisbiometrics.com/index.php/produtos/biometric-sdk-free I thought the best way would be to convert the headers they provide (not a good…
-
1
votes1
answer149
viewsError in my C program
I need to create a program in C, which removes (or copies) the values of a queue, using the output rules of a stack and add them into a new structure. I rode as below but there are two errors:…
-
1
votes1
answer1897
viewsHow to use pointer and vector in a single struct in C?
I cannot run a program that needs functions to execute a procedure, this function receives a vector of type struct by means of a pointer. There is no build error, but the program hangs while running…
-
1
votes1
answer125
viewsUsing C Pointer Pointer
hello I’m doing a work of algorithms in C and stopped at one part. The program has to read from an input file and insert into an n-ary Trie tree. The code that reads from the file is this: int…
casked 8 years, 5 months ago Amanda Polanski 11 -
1
votes2
answers37
viewsProblem deleting from recursion list
I’m trying to use this function to remove from the list, but it runs endlessly. void rDeleta(lista* l, int elemento) { if(l!= NULL) { if(l->elem == elemento) { lista* aux = l; l = l->prox;…
-
1
votes1
answer213
viewsC - Is it possible to insert a matrix into a structure?
A question that came to me a few days ago, was whether it is possible to insert a matrix into a structure, I think so, but on the road of doubts I decided to clarify. EXAMPLE typedef struct…
-
1
votes1
answer594
viewsC Language: Manipulating a vector of structs within functions
Hello, I created a struct: typedef struct { float valor; float peso; } objeto; And within the main() I’ve created a vector of these guys: objeto conjunto[50]; Then I need to swap one 'object' of…
-
1
votes1
answer172
viewsFunction return type for a chained list
What kind of return to use in a chained list? For example, insert at the beginning of the list. void inserir(pessoas **pessoa, int valor) no return (void). Or return a pointer from the list.…
-
1
votes1
answer131
viewsOutput of largest matrix value exiting incorrect
The code does not print the highest value of the matrix informed by the user #include<stdio.h> #include<locale.h> int main(void){ setlocale(LC_ALL, ""); int n, m, o=0, posic, posic1; int…
-
1
votes1
answer98
viewsC - Double popping size
I’m doing an IQA (Water Quality Index) exercise where I need to do a series of accounts. I created the functions and everything but always the result always comes out as it is in the image, I have…
casked 8 years, 5 months ago Joaquim Amorim 11 -
1
votes0
answers168
viewsHow to compile a . C/C++ on my website
Is there any way to compile a file. C/C++ within a website? let’s say a "file will be generated. c" and this file will be compiled... maybe you can do this in PHP or with some add-on.
-
1
votes2
answers908
viewsIndication of the first negative number of a vector
I have to make a program in C that saves the Inudice from the first negative number, but I’m not able to do it. The question is this down below: Prepare a program in C that enters 5 integers in an A…
-
1
votes1
answer1352
viewsHow to fill a heart?
when contouring a heart: #include <stdio.h> #include <stdlib.h> #define TAM_MAX_PONTOS_EXTERNOS 300 #include <math.h> typedef struct{ float x; float y; } ponto; int main() {…
casked 8 years, 5 months ago Bela Camargo 11 -
1
votes2
answers76
viewsError while running script
#include<stdio.h> #include<math.h> int main ( void ){ int x; int i; printf("Input the number (Table to be calculated) : "); scanf("%d", x); for( i = 1; i <= 10; i++){ printf("%d x %d…