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
votes3
answers1104
viewsChange of vector size in a structure
I have the following structure: struct Implicantes{ int posicao; char binario[5]; bool dontcare; bool tick; struct Implicantes *Next; }; It is possible to change the vector size of char "binary" of…
-
3
votes1
answer94
viewsRun a list of executables
I am trying to implement a program that runs concurrently a list of specified executables as command line arguments, considering executables without any arguments of their own. The program must wait…
casked 8 years, 8 months ago José Cunha 411 -
3
votes1
answer48
viewsUnderstanding the concept of export Symbols in shared libraries
I’m reading about this concept of exporting elements out of a shared library (DLL or OS). I’m reading that one existing publication on the GCC Wiki. The last example of the publication is this: //…
-
3
votes1
answer120
viewsWhy is an expression with rest and multiplication giving the wrong result?
Why is this code giving as a result -2 and not 7? #include <stdio.h> main() { printf("%i\n", 105 % 3*4 - 3*4 % (101 / 10)); system("pause"); }
-
3
votes3
answers3725
viewsConvert "Floating" to Decimal
So does anyone here know how I do to convert 1.01010101 for base 10 in the case this based on 2 "binary" the answer is that in base10 1.3320312510 . I need the logic to handle this case .. att…
casked 8 years, 8 months ago Matheus Francisco 650 -
3
votes2
answers2767
viewsDetermining a string within a C switch
I have doubts about how to define a string within a switch in C, without having to make a table of constants for this. The variable nome_lanche is the type char, but this with the number of…
-
3
votes2
answers176
viewsWhy am I getting Segmentation fault dynamic matrix?
They say not to cast on the return of function malloc, but this code there if the dimension of the matrix is above 4, it gives Segmentation fault from matriz[5][1] in the count: int main(){ int…
-
3
votes2
answers15417
viewsHow to add the diagonal of a matrix in C?
Help me in the following exercise: Make a program that defines an integer array of size 5x5. Next, initialize this matrix with random numbers between 5 and 9. Finally, your program must calculate…
-
3
votes1
answer972
viewsHow do they represent complex numbers in C?
How to represent a complex number z = x + yi?
-
3
votes1
answer201
viewsProblem with strlen()
Why is this code printing an extra number when I initialized the variable as 0? #include <stdio.h> #include <string.h> int main ( void ) { char texto[50]; int cont = 0; printf("\nInforme…
-
3
votes3
answers579
viewsHow to store variables in.txt files
I am a C beginner and I am looking to study how to let my program already configured every time it runs. It seems to me something very important, but I found little material. For example, "remember"…
-
3
votes2
answers233
viewsError: "invalid operands to Binary Expression ('char *' and 'char *')"
I need to create a string which contains "Mr: n" and the name of the person concerned (pessoa->nome). char* endereca(Pessoa* pessoa) { if(pessoa->sexo == 'M') { char *msg; msg =…
-
3
votes1
answer154
viewsReset repeated values of a matrix
Hey there, guys. I have an exercise where I must populate a matrix with random numbers from 0 to 9 and then replace the repeated numbers (except the first time the number appears) with the number 0.…
-
3
votes1
answer266
viewsSublime Text 3 - Headers autocomplete in the directory
After the failure to search for a plugin in sublime text 3, I come to ask for help. I need to recognize the libs installed on the system, for this I look for a plugin capable of providing an…
-
3
votes1
answer103
viewsSimple code performance improvement in C
I had a proof that the question was : Cosiderando that the periods of history are four: (1) period prior to 4000 BC; (2) from 3999 BC to 476 AD; (3) from 477 AD to 1789 AD; and (4) after 1790 AD.…
-
3
votes2
answers719
viewsKeyword in String C language
I’m trying to make a program in C to find a word in a string vector, returning the position of the word and when not finding returning -1. I’m having trouble with substring, type my program…
-
3
votes1
answer85
viewsObtaining different results by passing by value and passing by reference
I’m testing these examples of C codes: Call by value #include <stdio.h> /* function definition to swap the values */ void swap(int x, int y) { int temp; temp = x; /* save the value of x */ x =…
-
3
votes1
answer793
viewsPointer from struct to struct
Hello, I had asked a previous question about this problem, however I was able to solve but not learn about the problem itself so I tried to isolate it by creating a specific code for this problem…
-
3
votes2
answers102
viewsFunction calculates to a certain extent and to
I have a variable double making an account but it reaches a limit [in my case 1.367879] and does not increase more. The code is running normally, the problem is the result that is not more than…
-
3
votes2
answers4336
viewsClear button radio button
Good morning I would like to know how to clean what was clicked on the radio button, because in the textbox I use the name. Clear(); I wonder how I do on the radio button Thank you.
-
3
votes1
answer667
viewsSemaphore and Mutex in C
I have the following problem: A LAN house with 3 pcs, I will insert an X value in the terminal that will be the number of clients arriving in the lan house, customers can only use the Pcs that are…
-
3
votes2
answers80
viewsParameters for external call
I use Linux and by default (or at least in my case) it does not have screen brightness control, but has a program that gives to control. The point here is that I want to take the "user" value and…
-
3
votes2
answers895
viewsAdd prime numbers within a vector
I have this problem : Make an algorithm that takes 1500 numbers, calculate and show the sum of even numbers and the sum of prime numbers. So far so good, I was able to filter and add even numbers,…
-
3
votes2
answers2606
viewsHow to play an audio in C Language
If you can help me, I’m doing an Electronic Urn in C language, I’d like to put that little vote after a person takes a vow. I already have that sound in . mp3 and . wav format, how do I play that…
casked 7 years, 12 months ago Lucas Oliveira 105 -
3
votes1
answer658
viewsCan C++ and C# be used using C programming?
If I build a code for a sotfware and want to use the C, C++ and C# languages could I? Even if I use a compiler that reads all three?
-
3
votes1
answer48
viewsWhy do I get QNAN error when I calculate this?
Would someone help me check which client is closest to the found media? When I compile from the 1.QNAN0 that is when I do a mathematical operation invalidates, I just don’t see which one it is :/…
casked 8 years, 5 months ago Luciano Victor 47 -
3
votes2
answers91
viewsUsing a variable as a C file name
I’m using the function system("pathping xxx.xxx.xxx > c:\i.txt") to leave the program doing tests pathping and saving the result in a file to analyze later. Basically wanted to play this role…
-
3
votes1
answer227
viewsBug when using Cin detro command of a loop
When I run this code it Buga, i type 1 and it enters the registration function but not pause to read the data (keeps printing things non-stop)when I change the cin for scanf it works). You can make…
-
3
votes1
answer271
viewsIs there a problem assigning a value to a pointer?
I’m referencing myself by this site here How to declare pointers in C Usually when we want to start an integer type variable, for example, we do int inteiro = 4;but what if we did int *inteiro_ptr =…
-
3
votes1
answer842
viewsWhy does a string assignment in C not work?
I’m having trouble assigning a value to a variable of type char of a struct I’m doing the following #include <stdio.h> typedef struct Animal{ char nome[5]; // indiquei que a variavel nome tem…
-
3
votes1
answer4789
viewsPass vector by reference or value?
I want to create two functions, one is to fill a vector with random numbers. The other function is to show the contents of the filled vector. So I did it this way: #include <stdio.h> #include…
-
3
votes1
answer3048
viewsRotate PPM image by 90 degrees in C
Well, I’m trying to spin 90° an image in PPM Nxm format in C language and I’m not finding a way to do that. The program reads the image of an external file and ends up creating another, both in PPM…
-
3
votes1
answer61
viewsIs it possible to initialize a structure partially indicating the members?
In several languages it is possible to initialize a struct, or class, indicating which members want to put some value: var obj = new Tipo { b = 1, e = "x" }; In C we can initialize members in order:…
-
3
votes1
answer148
viewsDo not wrinkle data in the queue
In my program, I need to use a queue storage function inside another function, but I can’t run it, it doesn’t store it. I switched from Devc++ to Codeblocks and this appears: "expected 'struct Fila'…
-
3
votes1
answer322
viewsHow big is an "Enum" in C?
In general the enum keeps a whole, I can consider that this is the size of it?
-
3
votes1
answer42
viewsEven zeroed sum
This function should add the pair, but it is not, I did not understand the pq. #include <stdio.h> int somapar(int vet[], int n) { int soma = 0, i; for (i = 0; i < n; i++) { if (vet[n] % 2…
casked 7 years, 10 months ago Marcelo de Sousa 632 -
3
votes1
answer119
viewsProgram error C, vector store;
Good evening, I’m doing a program in c that should read 20 entries with data of interviewees. I managed to elaborate everything, but in the matter of reading this data I have a strange error... (It…
casked 8 years, 4 months ago Lucas Luan de Melo 87 -
3
votes1
answer778
viewsTypedef struct with C character array not working
I’m trying to create a kind of constructive data, but I’m having problems with the strings. typedef struct { char nome[30]; int idade; } p; p x,y; x.nome = “ana”; x.idade = 20; y.nome = “caio”;…
-
3
votes2
answers79
viewsError in program execution involving pointers
I was doing a C program that read string1 and deleted the first string2 occurrence. In string1:"Mouse Chewed Clothes" if I put "Ra" in string2, the program deletes correctly, without errors. But if…
-
3
votes3
answers6206
viewsHow to set a Struct as NULL in C?
I’m looking to see if there’s any content on struct then wanted to initialize the variables as NULL, for if they were equal to NULL would know that they were not created. snippets: Struct: struct…
-
3
votes1
answer326
viewsTorque conversion limit in C
I developed this code in C for conversion from integer to binary, but the limit is 1023. Any number above this, the conversion ceases to be performed Why and possible solution? int binario(int num)…
-
3
votes1
answer687
viewsHow does the frame-Pointer work?
In the official GCC documentation there is a option that allows you to remove the frame-Pointer when it is not necessary. What the frame-Pointer ago? How removing this pointer can improve…
-
3
votes1
answer179
viewsReturn of functions in C
A very common and practical thing in interpreted languages is the return of functions from another function. But in compiled languages as well as C, it is possible to return a function?…
-
3
votes2
answers721
viewsError in C printf
The error in question in a flag which was supposed to be correct, follows the code below: #include <stdio.h> #include <string.h> int main() { char var[50]=" Write Once Bug Everywere ";…
-
3
votes2
answers3951
viewsFactorial function in C does not return the result
What’s wrong with my code? int fatorial (int n, int num, int fat) { if(num >= 0) { fat = 1; n = num; while(n > 0) { fat *= n; //FATORIAL = FATORIAL*N n--; } } }…
-
3
votes2
answers331
viewsSave list in file
I have an exercise that I register trucks, cities, loads through a list, but I’m not able to save in a file (it’s the last function) when I select the save option(#7), it closes the program. What am…
-
3
votes1
answer146
viewsHow to encrypt a C-drive?
First to locate them, I have an idea of security, and to be able to put this idea into practice I would need to learn how to encrypt a USB stick. The idea is that the USB stick works as a 'key', and…
-
3
votes1
answer141
viewsProblems with a program that must read a registry file with a variable size field
I am relatively beginner in the programming area and I am doing a program where I need to read a file with 10 records with 4 fields (records of fixed size 60 and with size of each variable field).…
casked 8 years, 3 months ago Victor Pietro Moreno 33 -
3
votes1
answer988
viewsSearch for List Element
I want to search an element of a list through a name (character vector). I get the name (espm) in the function and start to search. The problem is that the function always tells me that "There is no…
-
3
votes2
answers7943
viewsHow to write a full number in C Language?
I’m doing a program here of a college job, and I don’t know how to value a string, my program will show the number I type in full. And I’m not getting the value for variable according to string.…
casked 8 years, 2 months ago Sr. Bigode 511