Tags down

Home » c


Unexpected result when trying to continuously prompt until they give an integer-only input
this will help i have edited the code according to what u guys have said and it works. Can someone explain to me why this works?
TAG :c
Date : August 05 2020, 06:00 AM , By : Andres Tafur
function-like macros and variables
this one helps. Instances of the name of a function-like macro that are not followed by ( are not replaced.Using names thusly is not a violation of constraints in the C standard. The standard even gives an example of using this behavior. C 2018 7.1.4
TAG :c
Date : August 05 2020, 04:00 AM , By : Сергей Гончар
Using makefile file as prerequisite in a rule
I wish did fix the issue. That dependency on Makefile is to make sure that it rebuilds when Makefile has been changed. For example, if you change CFLAGS in Makefile or a rule to compile or link, this dependency triggers a rebuild (provided object fil
TAG :c
Date : August 05 2020, 02:00 AM , By : Simon Levy
Questions about Structure definitions
it should still fix some issue student1 is an alias for the type struct student.And inside the group_project structure the type-alias group_project doesn't exist yet, so you have to use struct group_project.
TAG :c
Date : August 05 2020, 02:00 AM , By : หมูอ้วน กะ แมวน้อย
How many processes are created
This might help you "See" how the number of processes evolves as each statement is executed:
TAG :c
Date : August 04 2020, 03:00 PM , By : J.Walls
strcmp usage to terminate file writing doesn't work
hope this fix your issue I write the following code to write a text. strcmp is supposed to terminate the file writing when the user type . Still doesn't do it and i cannot exit the program , you have several issues in your code:
TAG :c
Date : August 04 2020, 03:00 PM , By : Peter
waitpid does not give me consistent results
this one helps. Edit: I should first clarify, when waitpid does not work, it does not work for all processes. As suggested I printed out the return value of waitpid and received interesting results. Firstly, during the unsuccessful runs, waitpid() re
TAG :c
Date : August 04 2020, 01:00 PM , By : Роман Биллер
Lex and Yacc symbol table generation and manipulation
I wish did fix the issue. The top level of a C program can only contain declarations and definitions. It cannot contain statements. So the following is not legal in the top level of a C program:
TAG :c
Date : August 04 2020, 12:00 PM , By : J. Misla
Including all the library statically instead of parts of the library upon linking/compilation
This might help you There is a GNU linker option --whole-archive which does exactly that:
TAG :c
Date : August 04 2020, 12:00 PM , By : HTT
Is it possible to create an array of generic function pointers?
help you fix your problem Declare the array as an array of function pointers. Actually the type of function pointer does not matter.
TAG :c
Date : August 04 2020, 10:00 AM , By : Mr Involute
Does lseek()'s SEEK_HOLE behaves as expected?
I hope this helps . A file "hole" is a range of file offsets that hasn't been written to. Writing zeros does not create a hole, it creates data in the file that happens to be zeroes. Sparse files have "holes", and when you read from a hole, the file
TAG :c
Date : August 04 2020, 04:00 AM , By : phoenix1275
Why does using struct work but typedef struct not?
around this issue You have a circular inclusion dependency, and you need to break this circle.The common way to do it is to stop including files in header file where it's not really needed, and use forward declarations when needed.
TAG :c
Date : August 04 2020, 02:00 AM , By : Prathyusha
How the the output will be printed?
it fixes the issue There is no sequencing between any of the printf calls—nothing in the code causes any of them in any process to come before or after any other. Therefore, any of the 4! = 24 orders are possible.(This assumes each output is printed
TAG :c
Date : August 04 2020, 12:00 AM , By : lisuiyi
Getting pointer issue in C program
I wish this helpful for you In the bubble function the variable arr is a pointer (type int *). That means arr[i] (for any i) is not a pointer, it's an int value.When you pass those int values to swap the compiler should complain about it, and it's co
TAG :c
Date : August 03 2020, 11:00 PM , By : Chandrashekar T.R.
c function that changes permission of file
seems to work fine The library function you're looking for is strtoul. Note the base argument, which can be used to direct it to parse numbers in octal.
TAG :c
Date : August 03 2020, 10:00 PM , By : Mike Danese
Why does isalpha() counter program gives wrong output? C
I wish this helpful for you The variable sum is not initialized to zero. So it is initialized with a random value (which depends on whatever value happens to be in its location.To fix, change the line to
TAG :c
Date : August 03 2020, 09:00 PM , By : johnwinters
Find two worst values and delete in sum
like below fixes the issue If your ADC is returning values from 5 to 16 14 bits and the voltage reference 3.3V, the voltage varies from 1mV to 3mV. It is very likely that it is the correct reading. It is very difficult to design good input circuit fo
TAG :c
Date : August 03 2020, 09:00 PM , By : arafat rahman
Equivalent of __LINE__ macro relative to beginning of function
wish helps you No, but you can do something somewhat equivalent by creating a line offset:
TAG :c
Date : August 03 2020, 07:00 PM , By : seoplus
Unexpected Outcome in Playfair Cipher Program
With these it helps The problem lies here (at least for the given example, I did not check the other cases, there could be errors in them too)
TAG :c
Date : August 03 2020, 06:00 PM , By : Jorge Luis Calderín
Integer division which results in less than 1
I think the issue was by ths following , You may apply the scale factor before doing the division.In your example you are effectively doing (assuming that x=1000)
TAG :c
Date : August 03 2020, 05:00 PM , By : Lee
Why does this expression come out to 4 in C?
hope this fix your issue Because q is a pointer the expression q+1 employs pointer arithmetic. This means that q+1 points to one element after q, not one byte after q.The type of q is int *, meaning it points to an int. The size of an int on your pla
TAG :c
Date : August 03 2020, 04:00 PM , By : Vladi
C Access element of Enum without declaring variable
To fix the issue you can do The names of enum constants are visible globally, so you can just do this:
TAG :c
Date : August 03 2020, 03:00 PM , By : Konstantin Belotserk
How to implement TAS ("test and set")?
this will help The C11 standard brings atomic types into the language.Among them is the atomic_flag type, which has an associated function atomic_flag_test_and_set Here it is from the standard:
TAG :c
Date : August 03 2020, 03:00 PM , By : biju
Ethernet CRC computation
it helps some times I've a small issue when computing a CRC by using two different methods. The 1st method uses a tool which is called Hexprobe Multibyte Calculator. The 2nd method uses a C program.
TAG :c
Date : August 03 2020, 03:00 PM , By : John
Can someone explain to me why my factorial recursion code can't be compiled
With these it helps i have made a simple program to calculate the factorial of a number. Below is the code.
TAG :c
Date : August 02 2020, 09:00 PM , By : user37154
Make same #define in every file
I think the issue was by ths following , I want to make a script that add a file ID number at every .C and .H file. This is used to identity from which file a error message is generated. , I generally use this macro for my error messages:
TAG :c
Date : August 02 2020, 03:00 PM , By : user6111525
String to ASCII Hex splitting in C
Hope this helps It seems you are over complicate it. You already have these values in K_char. Like
TAG :c
Date : August 02 2020, 01:00 PM , By : treasuresque
Non-negative integer?
around this issue The words “positive integer” apply to the numbers 1, 2, 3,… It does not include 0 because 0 is not positive.The words “non-negative integer” apply to the numbers 0, 1, 2, 3,… It includes 0 because 0 is not negative.
TAG :c
Date : August 02 2020, 07:00 AM , By : Lucas Qi
Issues with regular expression rejecting string
I think the issue was by ths following , Your regular expression matches a vowel followed by 2 other characters. [aoueiy] matches a vowel, . matches any characters, and adding {2} after it makes it match two characters. ao only has 1 character after
TAG :c
Date : August 02 2020, 04:00 AM , By : Pranav Midha
C program incrementing variable with for loop
I wish did fix the issue. You're initializing a to 0 when your loop is created( see a = 0 on line 9 of your code snippet). The first iteration will be just that, 0.
TAG :c
Date : August 02 2020, 12:00 AM , By : dino_ron
How to prevent LD_PRELOAD on a binary?
around this issue Just like scripts have an interpreter specified via the ! mechanism, excecutables work similarly. ELF executables have a field in the program header whose type is PT_INTERP and it gives a path to an "interpreter" for the executable.
TAG :c
Date : August 02 2020, 12:00 AM , By : 0xEC108
Why printf doesn't print directly a variable in C?
With these it helps Welcome to StackOverflow.printf asks for a string (null-terminated '\0') which as variable is a pointer to char (char*).
TAG :c
Date : August 01 2020, 09:00 AM , By : Jordin Martinez
What does it mean that condition?
With these it helps What should this current -> yes evaluate in if condition? (It's not complete code you can assume any question in yes) , This means if current->yes not 0 (not null pointer).
TAG :c
Date : August 01 2020, 07:00 AM , By : Anny
What is the difference between int (*cmp)(void) and int *cmp(void)?
To fix this issue What is the difference between
TAG :c
Date : August 01 2020, 04:00 AM , By : ljj
What is the wrong in the following c code ? MISRA quality warning message
To fix this issue I am getting MISRA QAC warning for the following code sample snippet. That is 'Value of control expression is not derived from an explicit logical operation.' , Your code has the following MISRA-C:2012 violations:
TAG :c
Date : August 01 2020, 04:00 AM , By : Ahir Verma
Problem with finding mistake in program with using valgrind
hope this fix your issue You forget that in C all char strings are really called null-terminated byte strings. The null-terminated bit it important, and will be used to find the end of the strings (by e.g. strlen).If it's missing strings functions wi
TAG :c
Date : August 01 2020, 03:00 AM , By : Tani
Creating C functions with arguments but no returns, what went wrong?
Does that help Your void get_numbers(float a, float b) function creates a copy of a and b on its stack. These variables are deleted upon function's exit. You should use pointers:
TAG :c
Date : July 31 2020, 05:00 PM , By : Chengzhang Zhong
What does 0600 mean in a function? Is it same as \200?
I wish this helpful for you I'm trying to write the memccpy() function myself. I'll call is ft_memccpy(). I found test main functions online and there are two test functions that confuse me. The first test function works fine with my ft_memccpy() but
TAG :c
Date : July 31 2020, 04:00 PM , By : Padhu
Function of retval in pthread_join
it should still fix some issue I'm learning threading in C in OS. I don't know why following code is giving me segmentation fault. Can anyone help me here? I am also confused a bit about how pthread_join uses its argument void ** retval. What is its
TAG :c
Date : July 31 2020, 03:00 PM , By : Steven Porter
I am getting a warning saying I have reached end of non-void function
hope this fix your issue Others have pointed out your error and offered alternative ways to code this. Let me offer another. It's an early-return method that keeps the code flatter, shorter, and easier to understand:
TAG :c
Date : July 31 2020, 06:00 AM , By : Vivek Radhakrishnan
Why does GCC only complain about an unsigned int argument being used with %i when -pedantic is given?
Does that help -Wformat-signedness controls whether warnings are raised when the argument type differs only in signedness from what's expected.From the gcc(1) man page:
TAG :c
Date : July 30 2020, 07:00 PM , By : THHNO
How random function really works in C?
it should still fix some issue That's because rand is a pseudo-random number generator, which means it returns the same sequence for any given input (the input is by default 1).You can seed the random number generator with the time to get a different
TAG :c
Date : July 29 2020, 11:00 AM , By : Vinicius Zelenkoff F
Linux: warning implicit declaration of function of system call
I hope this helps . That's because you need to write a wrapper for the system call in your program. Wrapper functions don't just magically show up in user-space when you write system calls:
TAG :c
Date : July 29 2020, 11:00 AM , By : Richter_Roller
Good STL-like library for C
I wish did fix the issue. The Glib library used on the Gnome project may also be some use. Moreover it is pretty well tested.IBM developer works has a good tutorial on its use: Manage C data using the GLib collections
TAG :c
Date : July 29 2020, 06:00 AM , By : user81517
Why am I getting a double free or corruption error with realloc()?
it helps some times As a general rule, you should never do a free or realloc on a user provided buffer. You don't know where the user allocated the space (in your module, in another DLL) so you cannot use any of the allocation functions on a user buf
TAG :c
Date : July 26 2020, 07:00 PM , By : tong
GTK implementation of MessageBox
With these it helps I have been trying to implement Win32's MessageBox using GTK. The app using SDL/OpenGL, so this isn't a GTK app. , Hmm, ok. I'd suggest code like this, then:
TAG :c
Date : March 29 2020, 07:55 AM , By : Nate3000
Privacy Policy - Terms - Contact Us © voile276.org