logo
down
shadow

C QUESTIONS

Assigning to two pointers at the same time in C
Assigning to two pointers at the same time in C
wish of those help I have a small segment of C code that I am a bit confused about. , The assignment operator (=) is right associative. This means
TAG : c
Date : November 22 2020, 11:00 PM , By : dvb_user
getchar returns a different character
getchar returns a different character
it should still fix some issue You're reading in a character such as , which is stored as its ASCII code, not a numerical value.You need to change your cases to look for the character '1', not the number 1.
TAG : c
Date : November 22 2020, 11:00 PM , By : Ahsan Malik
Understanding the enhanced syntax of for loop
Understanding the enhanced syntax of for loop
Any of those help In a for loop, each of the initialization, termination, and step expressions can be omitted. If the initialization step is skipped, there's no initialization done. If the step is skipped, no step is performed. If the test is skipped
TAG : c
Date : November 22 2020, 11:00 PM , By : ashu
Comparing char to string - C
Comparing char to string - C
will be helpful for those in need so I've viewed multiple threads here now on this site about comparing my char array to a string or something of that sort with things like strcmp and strstr however whenever I compiled it, I got the error: , You have
TAG : c
Date : November 22 2020, 11:00 PM , By : ramendra
How to omit the Bios Parameter Block in a bootloader?
How to omit the Bios Parameter Block in a bootloader?
it fixes the issue The BPB is an artifact of the FAT bootloader, and it only makes sense for floppy disks, and that only because it's not practical to detect the format geometry of floppy disks. If you are not using floppy disks, you do not need to b
TAG : c
Date : November 22 2020, 11:00 PM , By : Sita
Search linked list by substring and create a new linkedlist with all structs that contain the substring
Search linked list by substring and create a new linkedlist with all structs that contain the substring
help you fix your problem Imagine this case: you have a list L that contains just 2 nodes (A and B) in your linked list. Imagine that both nodes A and B contain a substring you are looking for:Original list L:
TAG : c
Date : November 22 2020, 11:00 PM , By : yasin
Procedure and pointers C
Procedure and pointers C
it helps some times First off, your original function is designed to return an int and you're returning a, which is an int pointer. Either return the int (*a), or change the function so it returns an int *.However, based on your actual message:
TAG : c
Date : November 22 2020, 11:00 PM , By : priyank chaturvedi
RegOpenCurrentUser(KEY_WRITE) on newly created user
RegOpenCurrentUser(KEY_WRITE) on newly created user
To fix the issue you can do If you already have the user profile loaded with LoadUserProfile(), you don't really need to use RegOpenCurrentUser() at all. You can instead use the hProfile field of the PROFILEINFO that LoadUserProfile() returns:
TAG : c
Date : November 22 2020, 11:00 PM , By : Pranav P
C Program with Pointer Increment False Values
C Program with Pointer Increment False Values
This might help you In order to make your code compile, I had to make one change: I added 'int' before 'main', so that the main function could correctly return 0.The problem is that you have created an integer array of size 4, but you want it to cont
TAG : c
Date : November 21 2020, 11:01 PM , By : George Lopez
Why won't a chunck of this program run in Linux but will on Windows?
Why won't a chunck of this program run in Linux but will on Windows?
I wish this helpful for you So I had to build a tiny little game that asks players to pick a number and see if they guess what the computer picks. It has 2 players and each can pass their turn to the other. One of the stipulations is that my professo
TAG : c
Date : November 21 2020, 11:01 PM , By : S. Gaur
Flow of the fork, how many forks do I have?
Flow of the fork, how many forks do I have?
wish help you to fix your issue execl does not return, it replaces the entire process image with /bin/echo. There are therefore zero "bar"s.
TAG : c
Date : November 20 2020, 11:01 PM , By : Tavo
C recursive function for product receiving segmentation fault
C recursive function for product receiving segmentation fault
This might help you I think instead of taking the mid.You can consider doing like this too check the following code
TAG : c
Date : November 20 2020, 11:01 PM , By : Lockito Marks
C String concatenation using memcpy not appending
C String concatenation using memcpy not appending
wish help you to fix your issue You are repeatedly copying the null terminator at the end of test. sizeof tbuf is 5.So all the C standard library functions will ignore all the other concatenants.
TAG : c
Date : November 20 2020, 11:01 PM , By : Robert Zhuang
Properly Partitioning QuickSort Array
Properly Partitioning QuickSort Array
may help you . I'm a beginner in C and I've been trying to code a Quicksort program that can take a randomly generated array of real numbers and its size as its argument, and then sorts the elements in ascending order. I cannot figure out what to put
TAG : c
Date : November 20 2020, 11:01 PM , By : Duongquoc Viet
Place String Literal Before Variable
Place String Literal Before Variable
this will help Probably your environment defines _UNICODE for compilation process and MessageBox macro is expanded to MessageBoxW. Try to replace your code with this:
TAG : c
Date : November 20 2020, 11:01 PM , By : Shaynee-honor Monroe
Sending payload with sigaction
Sending payload with sigaction
I hope this helps . You use a realtime signal (SIGRTMIN+0 to SIGRTMAX-0), so that the signals are queued, and you have a much lesser chance of missing one. (Standard signals are not queued, so if two signals are sent at nearly the same time, only one
TAG : c
Date : November 20 2020, 11:01 PM , By : Hsueh Lin Chen
using sizeof(void) inside malloc
using sizeof(void) inside malloc
To fix the issue you can do void is not the matching type of what pointer references. pointer references void *, not void.Avoid the mistake in the future by not coding the size of the referenced type, but coding the size of the de-referenced pointer.
TAG : c
Date : November 19 2020, 11:01 PM , By : Rachel Pargeter
Getting unused variable warning
Getting unused variable warning
Does that help But when I run it, it just outputs the 3 integers that I input in that order.
TAG : c
Date : November 19 2020, 11:01 PM , By : Brian van de Boogaar
C - Writing on second line of file
C - Writing on second line of file
hope this fix your issue Im doing the Hangman game on C and I have a trouble on one of the txt files. I'm trying to append "num_letters" on the second line of the file.My code prints on new line everytime I guess. Is there a "lightweight" way to skip
TAG : c
Date : November 18 2020, 11:01 PM , By : דוד רביבו
Unable to copy ip address from string to sockaddr_in
Unable to copy ip address from string to sockaddr_in
I hope this helps you . I am trying to copy an IP address from a string to struct sockaddr_in but somehow there's some error popping up. , This is the problem in your pastebin code:
TAG : c
Date : November 18 2020, 11:01 PM , By : Omar Gonzalez
Write a in c program using loop control to produce the following output
Write a in c program using loop control to produce the following output
hope this fix your issue You can try this, by simply using char as binary operator and the Increment and Decrement can be applied on chars as well as on integer. If you want to get input from the user you can use the scanf("%c") to read the chars and
TAG : c
Date : November 18 2020, 11:01 PM , By : charlestatumuiuc
GCC not warning on implicit cast from void * to void **
GCC not warning on implicit cast from void * to void **
may help you . As void * is the generic pointer, any other type can be implicitly cast to it.
TAG : c
Date : November 18 2020, 11:01 PM , By : Raji Zreik
char[] vs char* in scanf C when writing memory
char[] vs char* in scanf C when writing memory
seems to work fine As Igor Tandetnik says precisely in his comment, attempts to write to memory occupied by a string literal exhibit undefined behavior.Thus the line:
TAG : c
Date : November 18 2020, 11:01 PM , By : Marcin Jagielski
Recursive Calculation of a queue
Recursive Calculation of a queue
like below fixes the issue You try to understand a polish notation that is a form of notation for logic, arithmetic, and algebra. The expression for adding the numbers 4 and 5 is, in prefix/polish notation, written + 4 5 rather than 4 + 5.
TAG : c
Date : November 17 2020, 11:01 PM , By : Leandro Cuvelo
How to rotate bits to the left and add rotated bits to the right
How to rotate bits to the left and add rotated bits to the right
I hope this helps . Here is a tested and non-optimized solution to complete your source code:
TAG : c
Date : November 17 2020, 11:01 PM , By : Stscey Nicole
Print a size_t in a OS-independent architecture independent way
Print a size_t in a OS-independent architecture independent way
wish of those help Suppose you have the following snippet of code: , As you say, you can use the z modifier:
TAG : c
Date : November 17 2020, 11:01 PM , By : PDC
Radix Sort for floats in C - negative values get corrupted
Radix Sort for floats in C - negative values get corrupted
will help you The problem is your FLIP_FLOAT_A macro -- it's just wrong. You need it to flip all the bits of negative numbers (not just the bottom bit), and for the macros to be the reverse of each other (so FLIP_FLOAT_B(FLIP_FLOAT_A(X)) == X for all
TAG : c
Date : November 16 2020, 11:00 PM , By : Bubby Heke
ANSI C Separating the data from the file
ANSI C Separating the data from the file
may help you . I have a file with data like , Try like this
TAG : c
Date : November 16 2020, 11:00 PM , By : Baby's Breath
Pascal - how sets work?
Pascal - how sets work?
may help you . A set is an unordered collection of elements in which each element can occurr only once.Depending on what the unique identification of an element is, there can be many ways to implement a set, in any language.
TAG : c
Date : November 16 2020, 11:00 PM , By : Meralyn O Bartonico
K&R 1.6 Sample Code Displays Long Integers
K&R 1.6 Sample Code Displays Long Integers
Hope this helps Chapter 1.6 of KR gives sample code for counting digits, white space, other characters. What follows is their code, plus the return 0 line. , Look at this part of your code:
TAG : c
Date : November 16 2020, 11:00 PM , By : jadedtdt
Unexpected Infinite for loop
Unexpected Infinite for loop
will help you The reason is that your loop conditions (between two semicolons) look like this:
TAG : c
Date : November 16 2020, 11:00 PM , By : Nancy MacNamara Marc
using struct value in realloc gives segmentation fault
using struct value in realloc gives segmentation fault
I hope this helps you . Using C I have a struct which looks like this: , You use your macro point wrong.
TAG : c
Date : November 16 2020, 11:00 PM , By : Karoline Bonfim
c - Error: "incomplete type is not allowed" , IAR compiler
c - Error: "incomplete type is not allowed" , IAR compiler
will be helpful for those in need The error is due to the mixture when declaring the 'struct Raw_data_struct'. You can have a look of the post typedef struct vs struct definitions [duplicate].To declare your struct, you have to use:
TAG : c
Date : November 15 2020, 11:01 PM , By : potatopaws
How use correctly the pointers in a multi dimensional array?
How use correctly the pointers in a multi dimensional array?
Hope this helps Assuming you have int* arr; pointing to an array of size [ROWS_NUM][COLS_NUM], the calculation done when trying to access arr[X][Y] is arr + (X * COLS_NUM + Y). A general rule would be that an absolute index of an element in a multi-d
TAG : c
Date : November 15 2020, 11:01 PM , By : Louisa Maria White
Optimize hollow diamond pattern printing in c with minimum loops
Optimize hollow diamond pattern printing in c with minimum loops
To fix this issue you can save a lot of time by figuring out that (row
TAG : c
Date : November 15 2020, 11:01 PM , By : Marcelo Jesus da Con
Store an string on a Shared Memory C
Store an string on a Shared Memory C
wish of those help You need to copy string character by character to shared memory. Actual pointer pointing to the variable in shared memory needs to stay outside because shared memory can be in different addresses in different process. (You could us
TAG : c
Date : November 15 2020, 11:01 PM , By : Brian Jones
How to create a sine function in c
How to create a sine function in c
fixed the issue. Will look into that further The formula expects values in radians but you're using integers so I'm assuming you give it degrees. That will make the formula give wrong values.Also you use ints as return values from factorial() and pow
TAG : c
Date : November 15 2020, 11:01 PM , By : Liberato
Initializing n integers in 2-dimensional array
Initializing n integers in 2-dimensional array
To fix this issue I'm having a difficult time understanding how I can initialize and add 1 to n integers to each element in a 2-dimensional array. , This should give you a starting point:
TAG : c
Date : November 14 2020, 11:01 PM , By : Birdaveli Simien
Why is executing callback functions in kernel mode bad?
Why is executing callback functions in kernel mode bad?
Hope that helps Allowing the user to execute code in kernel mode would be an enormous security risk. That is to say, if a user space program is executing in kernel mode, there is no security: the game is completely lost and the user has full access t
TAG : c
Date : November 14 2020, 11:01 PM , By : Anders Sørensen
What is wrong with my bubble sort?
What is wrong with my bubble sort?
hope this fix your issue You are sorting the movieratings array in ascending order and printing ctr elements from the beginning so it prints the movies with lowest rating. sort the array in descending order i.e change this if (movieratings[i] > movie
TAG : c
Date : November 14 2020, 11:01 PM , By : Manjunath Arya
My Program has a couple of bugs and I dont know how to fix them
My Program has a couple of bugs and I dont know how to fix them
wish helps you You should set temp to NUM_ARRAY[counter+1] instead of NUM_ARRAY[counter]Try this:
TAG : c
Date : November 14 2020, 11:01 PM , By : Leon Myburgh
compile visual studio solution command line
compile visual studio solution command line
wish help you to fix your issue As usual with Visual C++, you open a command prompt window using one of "Tools" shortcuts ("VS2015 x64 Native Tools Command Prompt" or others located in C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studi
TAG : c
Date : November 13 2020, 11:01 PM , By : rubel hossain
Find the largest interesting number smaller than a given integer
Find the largest interesting number smaller than a given integer
help you fix your problem Issues with your code: you effectively destroy n doing the digit count but then try to reuse it for something else without refreshing its value (form largestInteresting?); you don't do the interesting number check in a loop
TAG : c
Date : November 13 2020, 11:01 PM , By : Chandra Sekar
Using Structs to hold all my variables in a C game?
Using Structs to hold all my variables in a C game?
I wish this helpful for you This is kind of better... but it's an opinion thing. First, It looks nicer. Second, if you're smart, you can dump the entire game structure to a file for later loading. (I don't know how, but I know it can be done)Also, yo
TAG : c
Date : November 13 2020, 11:01 PM , By : kamesh
How to find format of sscanf input assembly
How to find format of sscanf input assembly
Does that help I'm assuming x86 here. The ATT syntax is unfamiliar to me, but sscanf's second argument, the format string, goes in the rsi register. The string you're looking for, seems to reside at address 4027cd.
TAG : c
Date : November 12 2020, 11:01 PM , By : Javed Ansari
What is the instruction that gives branchless FP min and max on x86?
What is the instruction that gives branchless FP min and max on x86?
it should still fix some issue Most vector FP instructions have scalar equivalents. MINSS / MAXSS / MINSD / MAXSD are what you want. They handle +/-Infinity the way you'd expect.MINSS a,b exactly implements (a
TAG : c
Date : November 12 2020, 11:01 PM , By : Pablo Dominguez Cuev
initialization creates pointer from integer without a cast
initialization creates pointer from integer without a cast
fixed the issue. Will look into that further You have two errors: The one causing the problem is a missing address-of operatorin userNoun[lengthStr-1] expression The second problem is the size of "es" array: one[2] is too small to fit null terminator
TAG : c
Date : November 12 2020, 11:01 PM , By : ASHWANI GUPTA
Power function error
Power function error
around this issue Hello I am working on an investment program where you determine if it is better to put as much money as you can towards your student loans before saving for retirement or if it is better to only pay the minimum payment on your loan
TAG : c
Date : November 12 2020, 11:01 PM , By : babel-fish
C double pointer's array notation equivalence
C double pointer's array notation equivalence
seems to work fine If I have the following double pointer and I use it in an array form, which of the mentioned pointer forms is it equivalent to? , //argv[0] == (argv + 0), *(argv + 0), or (*argv + 0)?
TAG : c
Date : November 12 2020, 11:01 PM , By : satyam pawar
Parse $PATH variable and save the directory names into an array of strings
Parse $PATH variable and save the directory names into an array of strings
I wish did fix the issue. 2 main things wrong with your code, pretty much summarized by the comments: you strtok a public buffer (returned by getenv) you don't know how many variables will be in the buffer so you don't allocate the array of arrays at
TAG : c
Date : November 12 2020, 11:01 PM , By : zackzarapp
Bomb lab phase 4 func4
Bomb lab phase 4 func4
will help you Then, it calls func4, and compares the output of func4 to rsp (which I've done some testing and rsp is always 0) so i need to find a number that returns 0 when inputed into func4.
TAG : c
Date : November 11 2020, 11:01 PM , By : Arife Azman
print result using system calls
print result using system calls
it helps some times For my OS class, I need to print out the result of this matrix multiplication using only system calls. Following my lecture notes, I wrote up this piece of code. I use : , Just replace the sprintf value:
TAG : c
Date : November 11 2020, 11:01 PM , By : nytope
How to concatenate two char arrays in c?
How to concatenate two char arrays in c?
it fixes the issue I decided to try to make a concatenating function as strcat doesn't work for chars, only strings. , First, you shouldn't return reference to temporary
TAG : c
Date : November 11 2020, 11:01 PM , By : user6061821
How to check whether a number or not in array on structure in C
How to check whether a number or not in array on structure in C
should help you out Use isdigit() to determine whether the character is a decimal digit or not. If the char is a digit, populate it in the array.Another way, check if(ch >= '0' ch
TAG : c
Date : November 11 2020, 11:01 PM , By : 杨智慧
using non allocated space calloc
using non allocated space calloc
around this issue You have some dreaded undefined behavior (UB). Read Lattner's blog about What every C programmer should know about undefined behavior. Notice that with UB, very bad things could happen, or nothing serious. And the observed behavior
TAG : c
Date : November 11 2020, 11:01 PM , By : Dani Galicia
error C3861: 'ls_file': identifier not found
error C3861: 'ls_file': identifier not found
it helps some times I am learning to write my own Virtual File system but besides the logical error in program something other than that keeps coming i checked all the declarations within the program but couldn't figure it out. , In brief - you shoul
TAG : c
Date : November 10 2020, 11:01 PM , By : carlos perozo
Can anyone suggest me the necessary changes for my code?
Can anyone suggest me the necessary changes for my code?
it should still fix some issue This is a classic case of OBOB (Of By One Bug).The index of the last character of a n-length string is n-1, so when looping over all indices inside your string, the loop shouldn't be for (i = l; i
TAG : c
Date : November 10 2020, 11:01 PM , By : Petey
Unprintable integer pointer returned to GNU COBOL from C library
Unprintable integer pointer returned to GNU COBOL from C library
seems to work fine If you return an int you can directly check the RETURN-CODE variable and don't need to use RETURNING clause at all.If you want to use it: an int maps to retvar USAGE BINARY-LONG.
TAG : c
Date : November 10 2020, 11:01 PM , By : Rabia Haroon
Merge Sort Base Case (Recursion) Dissect
Merge Sort Base Case (Recursion) Dissect
To fix the issue you can do It is correct that the divide function never calls itself with arguments so that end < start. So therefore the if-statement could just as well be if (end == start).Maybe it's to catch if the divide function is called from
TAG : c
Date : November 10 2020, 11:01 PM , By : Fang
Confused about pointers and passing them as arguments
Confused about pointers and passing them as arguments
To fix the issue you can do I'm trying to create an array of arbitrary size, and for some reason, this code here works: , The problem is that the following expression
TAG : c
Date : November 10 2020, 11:01 PM , By : Peter Svetlík

shadow
Privacy Policy - Terms - Contact Us © soohba.com