logo
down
shadow

C QUESTIONS

Invalid conversion of char to float, different codes and no good results
Invalid conversion of char to float, different codes and no good results
wish helps you Please try below code. It is self explanatory. If you need any specific explanation, please let me know.
TAG : c
Date : November 22 2020, 03:01 PM , By : Nguyễn Thế Trung
Why doesn't my code for checking if a word is a palindrome work?
Why doesn't my code for checking if a word is a palindrome work?
To fix the issue you can do The actual problem was failing to remove the trailing newline. It sometimes helps to quote your output for easy recognition of non-printing character problems like tabs, newlines, etc.. Doing so immediately reveals the pro
TAG : c
Date : November 21 2020, 03:00 PM , By : Ganiu Hassan
My program compiles and when ran, it doesn't give me the input i put in
My program compiles and when ran, it doesn't give me the input i put in
Hope that helps The purpose of my program thus far is to create 4 arrays. 1 'char' array which will take in 10 different string values with each element having a maximum of 25 characters. And 3 other array's that will take in 10 integer values and st
TAG : c
Date : November 21 2020, 03:00 PM , By : Ahimtar HoN
How to find if a graph contains a cycle using a recursive DFS?
How to find if a graph contains a cycle using a recursive DFS?
I hope this helps . You are correct that there is no way to tell if the visited node has already been visited or if was visited as part of current traversal. One approach would be to maintain a array of vertices that can hold three states instead of
TAG : c
Date : November 21 2020, 03:00 PM , By : Bline Emilie
Memory mapped file cannot be closed without un-mapping, since it's still referenced
Memory mapped file cannot be closed without un-mapping, since it's still referenced
hope this fix your issue POSIX requires that there's a reference to mmap'ed file even after a close.
TAG : c
Date : November 20 2020, 03:01 PM , By : Levi Cooke
Why is this simple program giving me seemingly incorrect output?
Why is this simple program giving me seemingly incorrect output?
wish help you to fix your issue You're incrementing i before adding it to the sum! If each number has been incremented by 3, then your total error will add up to 15 in this case.Make sure you increment i only after you're done using it in each iterat
TAG : c
Date : November 20 2020, 03:01 PM , By : stanly
second printf not working when using a variable C-programming
second printf not working when using a variable C-programming
wish of those help You have to pass the pointer of a to scanf and remove \n from scanf. If you want to go on a new line add \n before your number is...The code becomes like that
TAG : c
Date : November 20 2020, 03:01 PM , By : gamingbookwyrm
Shared memory variable in c
Shared memory variable in c
help you fix your problem I would start with a little refactoring of your code, so it would be clear why mmap in your comment cannot work.Make your struct declaration non-annonymous:
TAG : c
Date : November 19 2020, 03:01 PM , By : Praveena Alluri
Linked List and Pointers in C
Linked List and Pointers in C
will be helpful for those in need The way the code is posted does not work, because it indeed misses deletion of the initial node in the head pointer. However, you omitted some code which apparently fixes the problem. Here is the code from the origin
TAG : c
Date : November 19 2020, 03:01 PM , By : CLeOpatra
Counting Character usage in text file? C
Counting Character usage in text file? C
help you fix your problem Rewind the pointer to the beginning of the file at the end of your for loop?This has been posted before: Resetting pointer to the start of file
TAG : c
Date : November 18 2020, 03:01 PM , By : shree devi hedubai
C: Why does assigning a 2D array of ints to an int** cause CLION to highlight the line?
C: Why does assigning a 2D array of ints to an int** cause CLION to highlight the line?
I wish did fix the issue. While someone can correct me on this one multidimensional array may not be and usually is not implemented as array of pointers, it's contiguous piece of memory with some syntaxic sugar on top of it for dereferencing.See this
TAG : c
Date : November 17 2020, 03:01 PM , By : Can Polat
How does fwrite work?
How does fwrite work?
I wish did fix the issue. The problem is the third parameter, count, indicates how many elements are in the array pointed to by ptr, not how many times the instance pointed to as ptr should be written. You're basically writing garbage that's in memor
TAG : c
Date : November 17 2020, 03:01 PM , By : Aya Majali
Why is my http server printing out the same bytes? (C)
Why is my http server printing out the same bytes? (C)
seems to work fine You are using the wrong data type for the bytes variable:The function prototype of read() is:
TAG : c
Date : November 17 2020, 03:01 PM , By : nawal shaltout
The following code doesn't stop looping
The following code doesn't stop looping
Any of those help If I'm not mistaken (can't really check without an example accounts.bin):It's because on line 17 you close the file within the loop; then pass the closed file on to fread in the next iteration. You should close the file just above t
TAG : c
Date : November 17 2020, 03:01 PM , By : yanis
Strcmp gives segmentation Fault
Strcmp gives segmentation Fault
should help you out You are basically setting stations = NULL and then doing something dereferencing it using temp. That's why the seg fault. Don't blame strcmp
TAG : c
Date : November 17 2020, 03:01 PM , By : SirPizza
Segmentation fault: 1902 vfscanf.c: No such file or directory
Segmentation fault: 1902 vfscanf.c: No such file or directory
this one helps. I try to write a C program at newly installed Debian system. The program stops with segmentation fault at scanf() function. This is simplified code:
TAG : c
Date : November 17 2020, 03:01 PM , By : Koladiya Jaydip
Mutex - counting occurrences of a char in files using threads
Mutex - counting occurrences of a char in files using threads
like below fixes the issue Hi I am writing a code for counting the number of occurrences of a certain letter inside one or more files using thread. I have to use one thread for each file e use a mutex to modify the global total. , I think your proble
TAG : c
Date : November 16 2020, 03:01 PM , By : EMMANUEL ADAH JOHN
Returning arrays in C instead of switch statements, nested set of values
Returning arrays in C instead of switch statements, nested set of values
I hope this helps . You need to create a 3 dimensional array. The first two dimensions correspond to the values of one and two, while the third is the array of numbers you want to return.You can declare the array like this:
TAG : c
Date : November 16 2020, 03:01 PM , By : vaibhav kansagara
Trying to pass addresses to simple variables to a function (pointers & loops) In C
Trying to pass addresses to simple variables to a function (pointers & loops) In C
wish of those help I'm trying to declare variables in my main() and then use their address and point to them in a function so that my function doesn't return any thing and all changes of the variable in the function goes straight to the main(). But e
TAG : c
Date : November 16 2020, 03:01 PM , By : Maxi Krautzik
Recursively list directories in C on Linux
Recursively list directories in C on Linux
Any of those help I need to list all items in a directory and list all items in any sub-directories. I have this function: , Please add a test to check that after calling :
TAG : c
Date : November 16 2020, 03:01 PM , By : Blues
Math operation in the test expression of the `for` loop - perfomance, optimisation
Math operation in the test expression of the `for` loop - perfomance, optimisation
wish help you to fix your issue No one makes more sense than other. Indeed, with optimization, it produces same code : https://godbolt.org/g/vzVJVFSecondly, time consumed by size-1 is, in most case, negligible vis-a-vis of time consumed by action in
TAG : c
Date : November 15 2020, 03:01 PM , By : Rishabh Ghosh
what is the difference between extern char **environ and extern char *environ[]
what is the difference between extern char **environ and extern char *environ[]
fixed the issue. Will look into that further I find this stuff impossible to follow without considering what is actually in memory, and how it is organized.Somewhere in memory are a bunch of blocks of data that contain environment strings -- "foo=bar
TAG : c
Date : November 14 2020, 03:01 PM , By : Hetal Patel
Is it possible to bind a socket to 2 adresses in c?
Is it possible to bind a socket to 2 adresses in c?
it helps some times No, you have to use two different sockets for that; bind each socket to one of the addresses.
TAG : c
Date : November 14 2020, 03:01 PM , By : user7453262
error when compiling testfiles from installed c-algorithms library
error when compiling testfiles from installed c-algorithms library
it helps some times The test-arraylist.c has line include "arraylist.h" but it is under the libcalg subdirectory not directly in the include path.libcalg subdir should be added to the include path or you have to modify the include like include "libca
TAG : c
Date : November 12 2020, 03:00 PM , By : Niwarner
Count alternating up / down sequences
Count alternating up / down sequences
I wish did fix the issue. You basically generate all permutations of the array elements and count the valid ones.Your code has a minor flaw:
TAG : c
Date : November 11 2020, 03:01 PM , By : Darrel Eugenio
ISR documentation with doxygen
ISR documentation with doxygen
I wish did fix the issue. Directly it is not possible as it is not valid C, but with workaround it could be possible.
TAG : c
Date : November 11 2020, 03:01 PM , By : Abdullah
How to solve the sum of three digit numbers,with how to calculate the second number
How to solve the sum of three digit numbers,with how to calculate the second number
it should still fix some issue (number % 100), for a non-negative number extracts the final two digits, and dividing that by 10 will effectively discard the unit digit due to integer division. So it's a scruffy way of calculating thenth.You can solve
TAG : c
Date : November 10 2020, 03:01 PM , By : Charles de Oliveira
Recursion C image compressor algorithm
Recursion C image compressor algorithm
seems to work fine Your computeCompressor() arguments on recursion seems wrong. If you pass m/2 for x or y argument, it will result to 4, 2 and 1 based on the recursion level which does not correspond to the top-left corner of the submatrices. You ha
TAG : c
Date : November 10 2020, 03:01 PM , By : zafiro666
Unix system programming: get a network identifier to be passed to getaddrinfo
Unix system programming: get a network identifier to be passed to getaddrinfo
To fix this issue I am following on a book the code in C to build a server using system calls. , There is a relatively simple typo in the getaddrinfo call
TAG : c
Date : November 09 2020, 03:01 PM , By : Adam Campbel
misaligned address access crash on linux wifi drivers on arc platform
misaligned address access crash on linux wifi drivers on arc platform
Does that help Simple. Just do the right thing. In general case, one would use memcpy:
TAG : c
Date : November 09 2020, 03:01 PM , By : Tammy Louise
Having a character appear repeated times in an array and score counts.
Having a character appear repeated times in an array and score counts.
may help you . Okay the thing is first answer is seemingly easy if you think of using the ascii value.What if I say that use the ASCII value as an index to an array. Any idea came?
TAG : c
Date : November 09 2020, 03:01 PM , By : Tania Makar
Given a number A(=2^N), how to get the N?
Given a number A(=2^N), how to get the N?
Hope this helps For example, , Sure there is - log2 ( double d )Use like this:
TAG : c
Date : November 09 2020, 03:01 PM , By : Aryan Chouhan
Reading Hex from an file
Reading Hex from an file
I hope this helps . If you want to read the data from the Memory bAddr then you must dereference the pointer for reading increment the Destination pointer
TAG : c
Date : November 09 2020, 03:01 PM , By : Krioae
Realloc affecting fgets
Realloc affecting fgets
Hope this helps The call of realloc() is not affecting fgets() - at least, not directly, predictably, or reliably.The first call of fgets(input, INT_MAX, stdin) in stringParser() has undefined behaviour because the pointer input is uninitialised.
TAG : c
Date : November 08 2020, 03:01 PM , By : user7451954
Run C server and client files in CLion at the same time
Run C server and client files in CLion at the same time
may help you . I'm currently taking a Data Networks class and need to run a local server and client at the same time using CLion. I'm very unfamiliar with the CLion so I might not fully understand if the answer isn't given super basic. , In the CMake
TAG : c
Date : November 08 2020, 03:01 PM , By : Joshua Han
How to check last character in command line arguements?
How to check last character in command line arguements?
hope this fix your issue Use strrchr like this
TAG : c
Date : November 08 2020, 03:01 PM , By : AIOOB
How to seperate user input word delimiter as space using strtok
How to seperate user input word delimiter as space using strtok
I hope this helps . As pointed in comments, there is at least two problems in your first code.
TAG : c
Date : November 08 2020, 03:01 PM , By : tyneyfox
Code to add element to the beginning of a list in c - what's the error?
Code to add element to the beginning of a list in c - what's the error?
wish help you to fix your issue The function and the test-program are incorrect.The node n1 shall be the head shall not it? However you are displaying the list passing the node n3 instead of the head that is instead of the node n1.
TAG : c
Date : November 07 2020, 03:01 PM , By : Yul
assembly output + questions about stacks
assembly output + questions about stacks
hop of those help? The variable j is the second parameter for func; it is stored in the register esi in the x86-64 System V ABI calling convention. This instruction mov DWORD PTR [rbp-28], esi put j into the stack.You can see it very clearly by writi
TAG : c
Date : November 07 2020, 03:01 PM , By : Jnap
memory management for a dynamically allocated 2D space
memory management for a dynamically allocated 2D space
I think the issue was by ths following , The problem in the second version is that you're doing the pointer arithmetic on an int ** instead of int *, because you have the cast outside the arithmetic.
TAG : c
Date : November 07 2020, 03:01 PM , By : Devin Hagerty
Don't get messages with epgm://, while with tcp:// do. Why?
Don't get messages with epgm://, while with tcp:// do. Why?
wish helps you For later visitors of the question, the code is fine and running. To see if it works on your system, change the for-loop to one loop and set the zipcode in the publisher on 10001, if you start the subscriber without an argument.
TAG : c
Date : November 07 2020, 03:01 PM , By : Megan Larson
C Recursion segmentation fault
C Recursion segmentation fault
wish help you to fix your issue I am new to C and trying to do a maze problem where 0 and letters are passing points and 1 is a barrier. , Here is a call sequence that leads to an infinite loop:
TAG : c
Date : November 06 2020, 03:01 PM , By : Meti
struct dirent in C d_name[256] and NAME_MAX definition
struct dirent in C d_name[256] and NAME_MAX definition
help you fix your problem NAME_MAX is declared in limits.h. You can also use pathconf() or fpathconf() to get the per-filesystem limit.
TAG : c
Date : November 06 2020, 03:01 PM , By : Jakob Hendrix
Defining a symbolic constant for GNU .ld script origin
Defining a symbolic constant for GNU .ld script origin
may help you . the LD manual states, for MEMORY :"The origin is an expression for the start address of the memory region. The expression must evaluate to a constant before memory allocation is performed, which means that you may not use any section r
TAG : c
Date : November 06 2020, 03:01 PM , By : Yuvraj
Bitwise operations in C coding
Bitwise operations in C coding
wish of those help Trying to explain the line GPIOx->MODER |= (mode MODER accesses the member MODER inside this structure x |= y is an abbreviation of x = x | y, which means "perform a logic OR of x and y, and write the result back to x mode
TAG : c
Date : November 06 2020, 03:01 PM , By : hotone
my open gl doesn't work properly?
my open gl doesn't work properly?
seems to work fine You have to initialize the GLUT library (see glutInit):Either:
TAG : c
Date : November 05 2020, 03:01 PM , By : dagr
Could not understand the output from the code
Could not understand the output from the code
Hope this helps the function: fork() can set the pid to any of three different meanings: -1 means an error occurred. =0 means currently running the child process. >0 means currently running the parent process.
TAG : c
Date : November 05 2020, 03:01 PM , By : Okta Somnii
How can I count how many times this loop has been ran after it finishes?
How can I count how many times this loop has been ran after it finishes?
hop of those help? C is not the kind of language that does things for you. Do it yourself:
TAG : c
Date : November 05 2020, 03:01 PM , By : Shwetha Niyogi
Converting C code to x86-64 assembly
Converting C code to x86-64 assembly
With these it helps I'm reluctant to just post the re-worked code I created as part of writing this answer. You aren't going to learn anything that way.So, here are some things you might want to fix to start:
TAG : c
Date : November 05 2020, 03:01 PM , By : דימה ג'ליזנק
Segmentation fault upon reading from an array
Segmentation fault upon reading from an array
I wish this help you If you are going to change the value of the pointer outputs declared in main
TAG : c
Date : November 04 2020, 03:01 PM , By : Blaz Dvorjak
const char **p comparison between pointer and integer if (**p == NULL)
const char **p comparison between pointer and integer if (**p == NULL)
this will help NULL is a macro defining a null-pointer constant, not the ASCII character NUL. If you want to test for a character NUL, then:
TAG : c
Date : November 04 2020, 03:01 PM , By : lumpyAlien
Are C unions never padded at the beginning?
Are C unions never padded at the beginning?
wish helps you Yes. As you note, structures never have leading padding. The address of a union always refers to the first element of any component of the union (with suitable casts), so there can't be any padding at the start of a union either.
TAG : c
Date : November 03 2020, 03:01 PM , By : riqiyoutian
finding subsets dicretely c
finding subsets dicretely c
it fixes the issue Ah because you don't cover the LSB or the 0th element. for (j = (n-1); j >= 0; j--) You missed the =.Also you have to know if j-th bit is set in i or not.
TAG : c
Date : November 03 2020, 03:01 PM , By : Patrick Verbruggen
Error: Expected Expression Before 'struct', when making a linked list
Error: Expected Expression Before 'struct', when making a linked list
help you fix your problem I keep getting an error when trying to make a linked list. The error is "expected expression before 'struct'" on both of the lines where I try to malloc() a new node. I've looked at similar questions and tried to fix my code
TAG : c
Date : November 03 2020, 03:01 PM , By : veera reddy
Parse a char string in c to get just the numeric digits after the exclamation mark
Parse a char string in c to get just the numeric digits after the exclamation mark
I wish this helpful for you Some hints, but not going to write the code for you:Use the string library functions like strchr to find the '!'. Then use strtod to convert a string to a number. Look at strtod's output to see if it had an error or if it
TAG : c
Date : November 03 2020, 03:01 PM , By : LeronLiu
Incorrect output from file
Incorrect output from file
This might help you I see two problems1) Your fgetc assigns to a char point. That is wrong. It shall be an int
TAG : c
Date : November 02 2020, 03:01 PM , By : Jiyad
Multiple consecutive strcpy(), display contains bits of every next strcpy()
Multiple consecutive strcpy(), display contains bits of every next strcpy()
Does that help These 2 lines show what's going wrong:Following line declares an array of char cP1_Move2_Name initialized with "POUND". The size of this array is exactly 6 bytes, that is the 5 characters from "POUND" plus one for the NUL terminator (s
TAG : c
Date : November 02 2020, 03:01 PM , By : nutraherlean09
Pointer Variables in C
Pointer Variables in C
wish helps you so I just had a quick question, I thought originally that code in general executes from top to bottom. So below I have attached an example in C using pointers and would just like someone to explain to me why the output when printing *p
TAG : c
Date : November 01 2020, 03:01 PM , By : MD Lawal
How to properly validate how many inputs were read in scanf
How to properly validate how many inputs were read in scanf
help you fix your problem You have two calls of scanf in your code. The result of the first call is ignored, while the result of the second one is checked.When you enter two numbers, the first scanf returns 2, which your code ignores. After that the
TAG : c
Date : November 01 2020, 03:01 PM , By : Ernst Umformtechnik
array of pointers to string characters
array of pointers to string characters
To fix this issue For starters according to the C Standard the function main without parameters shall be declared like
TAG : c
Date : November 01 2020, 03:01 PM , By : Daniel

shadow
Privacy Policy - Terms - Contact Us © voile276.org