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
answer54
viewsProblem in using char string
Guys help me: the exercise I’m trying to do is 4. Write a program in which: a) A character must be read that is one of the vowels of the alphabet and may be uppercase or lowercase. b) a function is…
casked 8 years, 5 months ago Guilherme Schults 27 -
1
votes0
answers84
viewsHow to deactivate the full screen of another program?
For example, a game that is in full screen (With full screen do not mean maximized, but "even fullscreen"). How do I stay in window mode with C++ ? I’ve tried using "Sendmessage" : #include…
-
1
votes1
answer477
viewsHow to increment the index of an unlimited array?
How can I increment an array within a structure? This is my structure: struct list { char name[50]; int products_list[]; } LIST[10]; I wanted to know the current number of elements in the array…
-
1
votes3
answers481
viewsDoubt with float
#include<stdio.h> int main ( void ){ float y = 12.0809; printf("The number %.2f is a float\n"); return 0; } I know that %.2f is used to consider only two decimal places, but would like to know…
-
1
votes0
answers133
viewsError in code.exe file stopped working - C language
I am a beginner programmer and have been spending a lot of time programming an old game. I made it work with the bot playing randomly, so to create another level of difficulty, I started creating a…
-
1
votes0
answers109
viewsDetermine the values of M and N
M and N are constants defined by #define int mat1[M][N]; int mat2[N][M]; int sum_element(int i, int j) { return mat1[i][j] + mat2[i][j]; } Suppose the above code generates the following in Assembly:…
-
1
votes1
answer407
viewsStruct defined in file. c auxiliary (with definition of functions and structs) is not recognized in main
I’m doing a C project, and I have 3 files: 1 . c containing the definitions of functions and structs. 1 . h containing the prototypes of these functions and structs Ae1 . c containing the main. No .…
-
1
votes1
answer305
viewsInsert a program into a windows window. h in C
I have this code in C using the windows. h library for creating a simple window. How to implement a program so that it appears inside this window. #include <windows.h> const char…
-
1
votes1
answer65
viewsSegmentation Fault in Double Chained Lists
I’m having a problem implementing double-chained lists, my code is as follows:: #include <stdio.h> #include <stdlib.h> struct MoveList { int curRow, curCol, newRow, newCol, isEat; struct…
casked 8 years, 4 months ago Enrico Robazza 11 -
1
votes3
answers871
viewsPolymorphism in C
It is possible to use Polymorphism in a structured language such as C? Languages such as c++,Java,etc(Object-oriented languages), have structures capable of inheriting functionalities for code reuse…
-
1
votes3
answers257
viewsProgram executable problem created in c
Well, I am currently facing a somewhat strange problem here with my program in c. I am creating a program in c that le integers of an external text file (using the standard library and fscanf…
-
1
votes2
answers5011
viewsDelete a struct record
I’m creating a record using struct, where I must have a menu to insert,. My difficulty is to create the delete function, I put a null value on the pointer of the position that will be deleted,…
-
1
votes1
answer679
viewsHow to get the Package Name from an Android app in a C library?
I would like to know how I can get the Package Name of my Android APP through a library written in C. What I want to get is this com/meu_app/mainframe/MainActivity or…
-
1
votes2
answers325
viewsHow to test the factorial in Main()?
How would the main() of this function below? The user enters a number and appears on the screen the factorial of the same. int fatorial(int num) { if (num >= 0) { int fat = 1; while (num > 0)…
-
1
votes1
answer61
viewsWhat is the difference between these two means of obtaining the Packagename?
I have these two code snippets, the two of them display the same result, so I’d like to know, what’s the difference between them. 1 jclass cls = (*env)->FindClass(env,…
-
1
votes2
answers497
viewsConflict of types in function
I’m trying to create a list structure using struct. Only when compiling my code, I get an error because even specifying the type Lista, he’s in some kind of trouble. Follow the full code: #include…
-
1
votes3
answers730
viewsInsert data into a vector to then print and multiply
Write an algorithm that reads two vectors of 10 positions and make the multiplication of the elements of the same index, placing the result in a third vector. Show the resulting vector. I wanted to…
-
1
votes1
answer550
viewsHow to pass the field of a struct to a function in a library separately?
Hello, everybody. I have a program that has a structure like this: struct itemDeLista{ char nomeProd[10]; float quant; float vUnit; int item; }; But I need to count the number of letters in the…
-
1
votes2
answers359
viewsRelate structs in C
Hello, I have to do the relation between structs in a work in C. I have a player struct with the name and code fields and an animal struct that has the name and code fields. I can normally insert…
-
1
votes0
answers19
viewsDoubt about memory address and pointer
The return of the printf function in the code below represents the memory address occupied by to? #include <stdio.h> main() { int a = 123; int *b = &a; printf("%d", &a); printf("%d",…
casked 7 years, 8 months ago Fábio Jânio 3,407 -
1
votes1
answer110
viewsIn the C language, I cannot work properly with a matrix
Hello. In a college project to automate the process of end-to-end encryption, I encountered some problems when dealing with matrices. NOTE: Sorry for code formatting errors. I still haven’t got the…
-
1
votes0
answers206
viewsFunction qsort to sort a struct
typedef struct{ long At[tam], Si[tam], Sf[tam]; }TDados; For this struct, wanted to understand how to order the struct by Sf using the function qsort. I wonder if someone could explain to me?…
-
1
votes0
answers86
viewsSave/Read large files
I’m having some difficulty in an academic project where I have to generate a certain number of records to have an X-size file. Ex.: 20gb of one .bin for so many records. My problem is how to do this…
-
1
votes1
answer1230
viewsWhich library to use to pause the system instead of getch?
#include <stdio.h> #include <conio.h> int main() { int x=4, y=7; printf("&X:%X &Y:%X x e y (%d,%d)\n",&x,&y,x,y); int *px, *py; px =…
-
1
votes1
answer5742
viewsPrint chained list in C
I’m creating a program that receives a vector and creates a chained list. I need help creating the "print()" function, which prints the generated chained list. I don’t know how to proceed. #include…
-
1
votes1
answer48
viewsProblems with C arrays input
I intend to make a simulator of memory ram in C and need to manipulate strings, at first I would like to use a 4x4 array for input of 4 memory positions with 4 bits: 1010 1000 1011 0000 Something…
-
1
votes2
answers564
viewsHow to equate a vector coming from a matrix with a matrix in the main function?
I need to match a matrix that is returning from a function to a matrix in the main function. My goal with this is to be able to pass this same matrix as parameter to other functions without calling…
casked 8 years, 2 months ago Miguel Goffredo 65 -
1
votes1
answer260
viewsCode::Blocks doubts
1-How do you put it as a pattern? unintentionally at first when he asks the question I asked not to question more unintentionally and now even reinstalling not appear more. 2-has how to make it in…
-
1
votes1
answer44
viewsI’m not able to store data in the file it creates the file but only stores nothing
void Criar_Ficheiro_Pizza() { FILE *B; if ((B = fopen("Pizzas.txt", "a")) == NULL) printf("\n\t !!! Ficheiro nao pode ser guardado!!!"); else { pizzas *aux; while(aux!=NULL) { fprintf(B,"%d\t %c\t…
casked 7 years, 8 months ago abdulay fonseca 31 -
1
votes1
answer114
viewsHow to put score in a sql Row
Well I am looking for a way to put score on a score of Rows that is made from my mysql. If the returned value is above 1000 it insert scores, for example: 1000 = 1,000 1000000 = 1,000,000 The code…
-
1
votes1
answer1148
viewsBubblesort sorting method with dynamic allocation + pointer
Hey there, guys. I’m trying to solve an exercise, by bubblesorte ordering method and dynamic allocation (No pointers and no dynamic allocation the exercise becomes easier, however, the teacher asked…
-
1
votes2
answers803
viewsRecursive search for files in directories
I have a function that searches file passed by parameter in directories using C language on Linux, I am able to enter the subdirectories and do the search, but when finishing the files in the…
-
1
votes1
answer80
viewsCan anyone explain to me why it’s not running?
#include <stdio.h> main() { float n1,n2; do { printf("Informe dois numeos:"); scanf("%f %f", &n1, &n2); if (n1>n2){ printf("DECRESCENTE"); } else { printf("CRESCENTE"); } } while…
-
1
votes0
answers702
viewsWhat does it mean and what is the purpose of 'Return 0'?
I recently started some studies on C/C++ and in the vast majority of the initial examples I saw, I came across return 0 at the end of the code. #include<iostream> using namespace std; int…
-
1
votes1
answer28
viewsGtkliststore, invalid string type
The code is giving invalid format string error when passing the Gtkcomboboxtext for a Gtkliststore. Error: (System:18726): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()…
-
1
votes1
answer97
viewsMatrix initialization error
I don’t understand this error in the matrix. #include<stdio.h> #include<stdlib.h> #include<math.h> #define MAX 800 int main () { float ponto[MAX][MAX]; float i, j, n, y, x, aux_st,…
-
1
votes1
answer81
viewsHow can I pass a Descriptor file to another process?
Recently I read a post by Peter Hutterer explaining about a new protocol called inputfd that is intended to pass a file Descriptor directly to other processes without the interaction of the…
-
1
votes1
answer94
viewsAccessing a pointer pointer ( c )
Why go down a level on the pointer ** lista / * lista we should use parentheses : ( * lista ), I asked the question because I saw in some examples on the internet that they didn’t use and also in an…
-
1
votes2
answers252
viewsError comparing two C strings
I type a value at the command line. That is in the binary vector. But if it is not return to the message from printf. But my problem is that it always goes into the cycle if, regardless of whether…
-
1
votes2
answers1031
viewsDivide vector according to delimiters and copy content to other strings in C
I need the main string "vector" to be traversed to the delimiter '=' and copy the values before '=' to "second" and the values after '=' to "third". I’m sure there’s a smarter way to do this, but as…
-
1
votes1
answer94
viewsWhy does code Blocks compile using g++ in a project configured as "C"
I’m learning C and using Codeblocks, I went on File > New > Project > "Console Application" > "GO" > Next and the question appears Please select the language you want use. I select C.…
-
1
votes1
answer638
viewsHow to run a . bat file from a C algorithm?
I wonder how I could run an external file (a .bat, for example) from a C algorithm.
-
1
votes1
answer1025
viewsIs there an IDE for developing GTK graphical interface?
I want to develop programs with Linux interface. My question is the following: Is there an IDE to develop a GTK GUI in the same style as Microsoft’s Visual Studio? The style I refer to is the "drag…
-
1
votes1
answer327
viewsFunction remove Start List
I am with this function to remove at the beginning, it happens that when I insert numbers as for example: 1 2 3, and then call the function to remove at the beginning and delete the number 2, while…
-
1
votes0
answers35
views18F45K22 - external interruption
One led is flashing every half second, while the other will only be access when I send a low level signal to RB0 on the microcontroller, I wonder if there is something missing, because I did exactly…
-
1
votes2
answers279
viewsProblem with Struct and Function in C
Good evening, I’m having a problem with the code I’m doing. I don’t know if I’m deleting the values correctly (and replacing them with the next one). The error is appearing in the replacement by the…
-
1
votes1
answer3084
viewsWhat are the ascii codes of the arrow keys on the keyboard?
I am working on a project in C and came across the following method static void keyEvent( unsigned char key, int x, int y) { /* quit if the ESC key is pressed */ if( key == 0x1c ) { printf("*** %f…
-
1
votes1
answer64
viewsDoubt about iteration with multiple parameters
This loop performs Log_base_2 of an integer value, at the end the result is available in the variable i. Why make a shift in the form valor >> 1 has no effect compared to valor = valor…
-
1
votes1
answer113
viewsRelation between structs in C
I have the following scenario: typedef struct Unidade{ int cod; } und; typedef struct Produto{ int cod; char nome[100]; und unidade; } prod; As you can see I have a unit type variable inside the…
-
1
votes2
answers87
viewsWhy is this code not generating the average correctly?
#include <stdio.h> #include <stdlib.h> float media(int n, float* v){ int i; float s; s = 0; for(i=0;i<n;i++){ s += v[i]; return s/n;} } float variancia(int n, float* v, float m){ int…