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
votes2
answers1846
viewsError invalid Conversion from 'int' to 'int*' using -fpermissive
I’m following a series of video-lessons in C (https://youtu.be/zZlIy3hp0c0?t=10m29s), but I found a problem. First I ran this code: #include <stdio.h> int main(void) { int x = 10; int…
-
0
votes1
answer86
viewsConversion C to C++
Guys, does anyone know what this code means in c++? #include <iostream> #define MAX_C (10) using namespace std; int compar(const void *x, const void *y) { int a = *((int *) x); int b = *((int…
-
0
votes1
answer102
viewsError sorting with dynamic allocation
I’m doing a C program on dynamic allocation and I’m having doubts on the ordering part. I made the code, and it even runs, but when I type the option ordena the screen just flashes, and doesn’t…
casked 9 years, 5 months ago yuripinheiro1402 21 -
0
votes3
answers103
viewsC pointers, error calling the relocation function
I have the C code written below, whenever I want to invoke the function of an error that says: --/home/Amuel-o-cara/Documents/Data Structures and Algorithm/Class 13.04.16 Alocarmemoria/main.…
-
0
votes1
answer2416
viewsremove a specific item from a chained list in c
have the struct LDISP { int idAviao; struct LDISP *prox; }; typedef struct LDISP ldisp; I already have the process of adding I would like to know how I can remove from a list an item whose int is…
casked 9 years ago user2296455 55 -
0
votes2
answers6901
viewsCodeblocks -> "It seems that this project has not been built yet. Do you want to build it now?" - How do I fix this?
It seems that codeblocks cannot find the folder where my project is. I have tested the separate compiler and it is working perfectly. Does anyone know how I fix it? Look at: gcc -Wall -g -c…
-
0
votes1
answer48
viewsnon-zero getpid and getuid for root
I have the following problem. While executing: void main(void){ uid_t getuid(void); gid_t getgid(void); uid_t user_id; gid_t group_id; printf("user_id: %d\n",user_id); printf("group_id:…
-
0
votes2
answers627
viewsCalculation in program C results in zero in any calculation value
I’m trying to do a kwh calculation. I am using values in float and the value kwh*0.2 must be calculated, but the result is always zero. And I don’t see any errors in the code.…
casked 8 years, 11 months ago Emerson Silva 13 -
0
votes1
answer396
viewsKnow how many elements I have in an array in Arduino
I have an ARRAY of at most 100 row by 2 columns, which will be filled by a user. My program will play user activity after. What I want to know is how to know how many lines were filled with data.…
-
0
votes1
answer65
viewsVirtual page - Frame allocation algorithm
Guys, can someone explain me this algorithm of Frame allocation? I’ve broken my head trying to understand what each function does but I can’t make sense of it. Code tutorial link below:…
-
0
votes0
answers41
viewsPHP programming with beagle bone , how to receive a variable
I am making a web server using Beaglebone black, I would like to know how to receive a variable on the web server and access it locally in a C program on Beaglebone .
-
0
votes1
answer139
viewsDoubts about pointer pointers and function returns
Hello, folks. I’d like to know why the function below would need a pointer to pointer, in case a **root, for the line /1/ could modify the *root, while the line /2/ can modify it without having to…
-
0
votes0
answers158
viewsThere is no ANSI driver in windows 7, which is a replacement?
For simple formatting in C, can be used controller ANSI DOS, which had on IBM’s micros and Windows XP, but windows 7 does not support the controller ANSI. There is a substitute with such functions?…
-
0
votes2
answers153
viewsWhy does it not read the string matrix?
I am creating a code that for now needs to read the name of N companies (whose N is given). I’m trying to enter the names but the program just doesn’t read and it’s the first time I try dynamic…
-
0
votes1
answer148
viewsSegmentation Fault when initializing Code Blocks in Fedora
Error presented: Try to migrate conf-Folder The Places Where the Configuration files and user-data files are stored have been changed to be more standard-conform. Now Moving "/root/.…
-
0
votes1
answer30
viewsChecksum ip Packet
Guys would like to understand the 4 last lines , why do all these bitswise? Code complete. Follows the code: static int in_cksum(u_short *addr, int len) { register int nleft = len; register u_short…
-
0
votes0
answers53
viewsSchema Gtk/Glade error
Good evening guys, all good ? I have an error running an interface created for a C program using GTK/GLADE. The program compiles normally but at the time of execution it claims that libgtk-3-0.dll…
-
0
votes1
answer119
viewsError in file code. c
I need to make a simple search engine. Just open one arquivo.txt, search for a desired word by the user, check how many times a word appears in the file and if it exists in the file. But this giving…
-
0
votes0
answers33
viewsStruct in a pack?
What happens when I put an attribute packed in a struct? What is the difference of struct that has that attribute? struct test { unsigned char field1; unsigned short field2; unsigned long field3; }…
-
0
votes1
answer219
viewsProblems to calculate the largest prime int in C
Hello. I’m trying to calculate the largest prime number that fits into an int variable. My idea was to start with the largest int, and go checking in descending order until you find the first prime…
-
0
votes2
answers57
viewsCreate dynamic structures based on a text file
Is it possible to create a dynamic structure based on information stored in a text file(file)? Or this is only possible if the file is binary? For example: if I have a number (5) in a text file, can…
-
0
votes1
answer100
viewsSocket C ansi header Post
Hello I have a socket in C ansi without using adcional libraries working normally with http requests. When ordering on a new server do not get any response, using the Curl lib, results 100-continue…
-
0
votes3
answers72
viewsLargest number in array, does not display
This code does not show how the largest element inserted in the matrix should be or the correct position. What’s the mistake? #include <stdio.h> #include <stdlib.h> #define lin 4 #define…
-
0
votes2
answers288
viewsRun the TOP command in exec on C - Linux?
Updated code ,it does not execute commands #include <stdlib.h> #include <unistd.h> #include <stdio.h> void ExeclLS(int argc, char **argv) { char *args[] = {"ls", "-aF", "/", 0};…
-
0
votes1
answer65
viewsProblem with matrix editing outside of main()
So, guys, I’m in over my head with the code below. I started studying C pointers a few days ago and I believe it’s the solution to my problem, but I don’t know how to handle the code. The problem is…
-
0
votes1
answer40
viewsProblems in a string array of a structure
I’m having a problem with an array of strings I’m trying to access from a structure. The structure is placed in a header.h which has the following format : typedef struct { char *produtos[200000];…
-
0
votes1
answer112
viewsPass by reference of a vector structure in C!
I have the following code: #include <stdio.h> #include <stdlib.h> #include <string.h> #define TAM 3 typedef struct{ char nome[50]; char musica[50]; int integrantes; int ranking;…
-
0
votes2
answers80
viewsStopped running when I added the printf
I made a source code in C, conditional, but when I add a printf function windows reports that the program stopped running. Look at the code: 1: http://i.stack.Imgur.com/a9YUf.png NOTE: I USE WINDOWS…
-
0
votes0
answers303
viewsVisual Studio build error
I am very new in Visual Studio, I am trying to compile a server and returns me thousands of errors similar to these: 1>int_guild.obj : error LNK2019: unresolved external symbol _strtoi64…
-
0
votes1
answer106
viewsInfinite loop when passing memory addresses
I was doing this code whose goal is to use pointers to fill an array with an arithmetic progression. But I can’t get out of the first loop. int main() { int r, // Razão da PA i, // Contadora pa[10],…
casked 9 years, 1 month ago Jefferson Carvalho 726 -
0
votes1
answer69
viewsDoubts of logic in C
I’m solving a small exercise in C that should print the predecessor and successor of a number on screen. The predecessor prints correctly, but the successor always shows 108. regardless of the…
casked 9 years, 1 month ago JadilsonTorres 1 -
0
votes1
answer141
viewsTwo-dimensional array size within the C-struct
Hello. I am doing a job I read a txt (the file name is passed by argv[]) and I write a graph. In the first line of the file two parameters are passed as follows: V A These parameters are integers…
-
0
votes1
answer75
viewsEnable variable spacing Code::Blocks
I love Code::Blocks, only that there is a problem, I wanted it to already space the instructions as soon as I put ';' the same as Visual Studio. Ex: for(int i=0;i<n;i++)`` >> ``for(int i =…
-
0
votes1
answer119
viewsDoubt with use of`pthread` in Posix
I am using the following routine with library command pthread.h: // // Declaração // pthread_t threads[NUM_THREADS]; // // Criacao // for(...) { pthread_create(&threads[i], NULL, MainTH, (void…
-
0
votes3
answers109
viewsError in compiling ola mundo
#include <stdlib> int main() { printf("Ola Mundo!\n"); return 0; } I can’t run the program on Ubuntu! Build error
-
0
votes1
answer106
viewsWrite a function within certain requirements
Can someone help me with the exercise below? 1) Write a function called update, which has no return (void), which will have four input parameters: (a) a pointer/reference to a structure of type DATA…
-
0
votes0
answers53
viewsWhy can I restore old ESP value
Well I have here a question that involves Assembly and C. The variable format has more than 4 bytes, yet I can do pushfrom it without using cast and return the old ESP value after push. How is it…
-
0
votes0
answers32
viewsError in binutils when doing Cross-Pilot. lex: not found
I am cross-piling for the i686-Elf architecture with a Debian 8 86_64 bit host I already uninstalled and installed flex but the error continues! I’ll leave the terminal output. checking for gcc...…
-
0
votes0
answers43
viewsHow to get Datetime from the internet?
How can I do to get the current date from the internet, and convert the result to char *data_atual? Example of the intended websites: nist.time.gov and/or time.windows.com. I would like two…
-
0
votes0
answers27
viewsWhat is the difference between Casse obj; and Class* obj = new Class(); in C++?
I know that using Class obj; I’m storing obj in Stack and with Class* obj = new Class(); I’m storing in Heap. But in practice, what’s the difference?
-
0
votes0
answers47
viewsC library with auto checksum
I’m creating a library/library for Android in C, and I’d like to know how to get it to display its own checksum, so, should you suffer any "alteration" once compiled, the checksum change.…
-
0
votes1
answer426
viewsHow to change the size of a global structure vector in C?
My idea is to declare a global vector of a structure x, but I will only have the size of the vector in main. How can I declare the vector and then tell how big it is? I have an equivalent solution…
-
0
votes1
answer118
viewsLanguage Problem C, Program does not respond
I have a problem with my program in C, and in the registration of the second student’s second grade the program stops responding. Follow the code with the explanation of the problem. /* Faça um…
casked 9 years ago Fabio Soares 51 -
0
votes2
answers889
viewsHow to remove a structure element
I’m having trouble removing an item from the list. Follows code made: #include<stdio.h>// colocar no esquininho do AVA ate amanha #include<stdlib.h> #define max 5 typedef struct info {…
-
0
votes1
answer244
viewsBuild error -lpthread
I am trying to compile a file. c, but whenever I call gcc filename. c, I have the following error: c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot find -lpthread…
-
0
votes1
answer58
viewsProblem for creating a list linked in C
Hello, I’m trying to create an automatically linked list, IE, it will be created within a for. But for some reason I keep getting the error Segmentation fault, follow the code: no *lista, *cabeca;…
-
0
votes1
answer337
viewsUnderstand code C++/Assembly
I am studying a Node, and in this process I decided to help in the study migrate a system in c/c++ to Node, but I am not familiar with c/c++ and I appeared a piece of code that I am not able to…
-
0
votes1
answer86
viewsHow to split a string sprintf into multiple lines in C?
I got a string on sprintf and I would like to divide it into multiple lines, because it gets big and the code gets messy. sprintf(srt,"GET %s HTTP/1.1\r\nAccept: text/javascript\r\nUser-Agent:…
-
0
votes1
answer281
viewsWhat’s wrong with my code? It keeps giving error "[Error] Ld returned 1 Exit status"
Get any value and ask the user if this value is in dollars or in real. If they are dollars, convert them to real ones. If they are real, convert them to dollars. Repeat operation until the sum of…
casked 9 years ago Lucas Debiagi 1 -
0
votes1
answer656
viewsWhat is the complexity of each of these functions?
Simple circular list implemented in C #include <stdio.h> #include <conio.h> #include <stdlib.h> typedef struct s_no{ float info; struct s_no* proximo; } no_t; no_t* cria (){ return…