logo
down
shadow

C QUESTIONS

How do you determine the size of a file in C?
How do you determine the size of a file in C?
like below fixes the issue How can I figure out the size of a file, in bytes? , Based on NilObject's code:
TAG : c
Date : January 25 2021, 03:26 PM , By : Kilimanjaro
Decoding printf statements in C (Printf Primer)
Decoding printf statements in C (Printf Primer)
this will help Danny is mostly right.a. unsigned decimal, minimum 4 characters, space padded
TAG : c
Date : January 25 2021, 07:01 AM , By : Chris Hubbard
Are the shift operators (<<, >>) arithmetic or logical in C?
Are the shift operators (<<, >>) arithmetic or logical in C?
will be helpful for those in need According to KR 2nd edition the results are implementation-dependent for right shifts of signed values.Wikipedia says that C/C++ 'usually' implements an arithmetic shift on signed values.
TAG : c
Date : January 25 2021, 07:01 AM , By : S. Fenz
How to avoid redefining VERSION, PACKAGE, etc
How to avoid redefining VERSION, PACKAGE, etc
I hope this helps you . Some notes: you didn't mention how config.h was included - with quotes or angle brackets. See this other question for more information on the difference. In short, config.h is typically included with quotes, not angle brackets
TAG : c
Date : January 25 2021, 07:01 AM , By : Jaya
When should I use type abstraction in embedded systems
When should I use type abstraction in embedded systems
wish help you to fix your issue I use type abstraction very rarely. Here are my arguments, sorted in increasing order of subjectivity:
TAG : c
Date : January 24 2021, 02:01 AM , By : Tornike
How to implement continuations?
How to implement continuations?
I wish did fix the issue. I remember reading an article that may be of help to you: Cheney on the M.T.A. :-)Some implementations of Scheme I know of, such as SISC, allocate their call frames on the heap.
TAG : c
Date : January 23 2021, 02:43 AM , By : picamiolo
String.indexOf function in C
String.indexOf function in C
may help you . Is there a C library function that will return the index of a character in a string? , I think that
TAG : c
Date : January 22 2021, 04:47 PM , By : Tim Tyrrell
Passing multidimensional arrays as function arguments in C
Passing multidimensional arrays as function arguments in C
Does that help You can do this with any data type. Simply make it a pointer-to-pointer:
TAG : c
Date : January 22 2021, 04:45 PM , By : qba73
Choosing a static code analysis tool
Choosing a static code analysis tool
will be helpful for those in need Don't overlook the compiler itself.Read the compiler's documentation and find all the warnings and errors it can provide, and then enable as many as make sense for you.
TAG : c
Date : January 22 2021, 02:12 PM , By : Eniac
How do you format an unsigned long long int using printf?
How do you format an unsigned long long int using printf?
I wish this helpful for you Use the ll (el-el) long-long modifier with the u (unsigned) conversion. (Works in windows, GNU).
TAG : c
Date : January 22 2021, 02:12 PM , By : 03B
APR memory not freed after pool destroy
APR memory not freed after pool destroy
Does that help You are invoking Undefined Behavior in at least two places. I compiled on my linux (Mint a derived of Ubuntu), gcc 7.4. Your program crashes at the first apr_pool_create because you did not invoke the appropriate initialization functio
TAG : c
Date : January 12 2021, 09:11 PM , By : lonehunter01
I have some question about how to save generated data in a for looping in a new string
I have some question about how to save generated data in a for looping in a new string
will be helpful for those in need It seems you want to have all the combinations of two characters as strings in an array. BTW: this is not random. A solution could look like this:
TAG : c
Date : January 12 2021, 09:11 PM , By : Robert Daniel Pickar
How to declare a global dynamic array with C/OpenACC with PGI compiler
How to declare a global dynamic array with C/OpenACC with PGI compiler
Does that help When you use "declare" with a pointer, you are creating a global device pointer but not the array that pointer points to. Hence when you try and update the array it doesn't exist and why the runtime errors.To fix, you also need to add
TAG : c
Date : January 12 2021, 08:33 AM , By : Harvey
Qsort() doesn't work on a struct
Qsort() doesn't work on a struct
I wish this helpful for you In short: Your comparison function is wrong. Citing a qsort() manual:
TAG : c
Date : January 12 2021, 08:33 AM , By : Hadley
Cant free info_ptr in libpng
Cant free info_ptr in libpng
I hope this helps you . Try after removing this manual free. I think this free should be taken care automatically
TAG : c
Date : January 12 2021, 01:40 AM , By : Tom D
I don't understand why I'm definitely losing blocks of memory
I don't understand why I'm definitely losing blocks of memory
hope this fix your issue In the end the fault was in main function where I forgot to free the newly created parameter list. for @GSerg and @datenwolf for pointing out other mistakes in my code.
TAG : c
Date : January 12 2021, 01:40 AM , By : user109285
ATMEGA328p convert analog value to voltage
ATMEGA328p convert analog value to voltage
will help you Yeah this is a common mistake. One thinks 10 bits = 2^10 = 1024 and so there will be 1024 steps, right? Nope, 10 bit ADCs only give output up to 1023 (3FFh), because that is the largest number you can fit into 10 bits. So if you do arit
TAG : c
Date : January 12 2021, 01:40 AM , By : 66.
how to use audit in linux to monitor a file using libaudit
how to use audit in linux to monitor a file using libaudit
this one helps. It turns out I forgot to run with sudo, this can only be run with root permission but it did not crash, just nothing was reported.
TAG : c
Date : January 11 2021, 05:14 PM , By : Guid
Is there a way to find the position of a special character '\n' in a file in C?
Is there a way to find the position of a special character '\n' in a file in C?
will help you I want to find the position of a '\n' in a file and print out the remaining characters after \n
TAG : c
Date : January 11 2021, 03:34 PM , By : Kristian Hofslaeter
Array is printing with weird question mark symbols when printing fibonacci sequences
Array is printing with weird question mark symbols when printing fibonacci sequences
should help you out When printing each Fibonacci sequence the first couple of sequences print in weird symbols or not at all if printing more than 8 sequences. , There are different problems in your code:
TAG : c
Date : January 11 2021, 03:34 PM , By : Rob
Self provoked buffer overflow in C
Self provoked buffer overflow in C
wish helps you When you use char overflow[], the memory for the overflow array is in the same stack frame as buffer, and it's probably located right after it. So when you exceed the bounds of buffer, you're writing back into overflow, not overwriting
TAG : c
Date : January 11 2021, 03:32 PM , By : bdurbin
Why my code refuse to compare the generated hashes
Why my code refuse to compare the generated hashes
should help you out The crypt function returns a pointer to a static data buffer. That means that each time you call crypt that static data changes, so hash points to a buffer that changes on each iteration. This is why it matches every time.You need
TAG : c
Date : January 11 2021, 03:32 PM , By : user179938
Makefile No such file or directory
Makefile No such file or directory
this one helps. I'm trying to do some simple linked list practices to familiarize myself with C. I currently have the following makefile. , You need to compile the .c file, not .h; and get rid of -o app.
TAG : c
Date : January 11 2021, 03:32 PM , By : Paul McKee
Why is pthread_equal threadsafe?
Why is pthread_equal threadsafe?
around this issue This implementation of pthread_equal (which is going to be specific to the POSIX implementation it goes with) does not access any variables except local ones. In C, arguments are always passed by value. thread1 and thread2 are local
TAG : c
Date : January 11 2021, 03:32 PM , By : Bas
Is there a way I can shorten this if statment?
Is there a way I can shorten this if statment?
this will help Um, what an example, whatever.Why don't you use strchr? strchr returns the pointer to a character in a string (if found), NULL otherwise.
TAG : c
Date : January 11 2021, 03:28 PM , By : Florian D.
fscanf() != EOF as exit condition of loop exits at the wrong time
fscanf() != EOF as exit condition of loop exits at the wrong time
wish of those help You can't use fscanf() to read a binary file, and your is a binary one.Knowing the binary format of file, you can reproduce the structure and copy it from file using a fread().
TAG : c
Date : January 11 2021, 03:28 PM , By : Adam Hill
I made a stack using linked list (without array), but my pop function is not working
I made a stack using linked list (without array), but my pop function is not working
This might help you Your right that the pop would not work. All you are is setting the temp pointer to NULL when you found the end element. What you need to do is to free the element at temp first, and then set the pointer that points to it from the
TAG : c
Date : January 11 2021, 03:26 PM , By : Matt Watson
How can I start with this problem and fix my code?
How can I start with this problem and fix my code?
wish of those help To start with approach these sort of problems in the easiest possible method. using nested for loop.As mentioned in one of the comments add a nested for loop.
TAG : c
Date : January 11 2021, 03:26 PM , By : nseibert
How to identify which file implicitly relies on linkage with a library?
How to identify which file implicitly relies on linkage with a library?
seems to work fine I tried to search replace calls to abort() but I still have these errors.
TAG : c
Date : January 11 2021, 11:39 AM , By : pacorro2000
Does a stray \ [backslash] have any meaning in C code?
Does a stray \ [backslash] have any meaning in C code?
I wish this helpful for you The backslash is escaping the newline that follows it. It is used to logically combine two or more lines in cases where whitespace is relevant, such as in the middle of a string constant or as part of a macro definition so
TAG : c
Date : January 10 2021, 02:06 PM , By : General Mills
strtok returns NULL despite not having reached the end of the string
strtok returns NULL despite not having reached the end of the string
this one helps. I am writing a program that parses input from stdin and calls functions according to the input. The inputs my program is supposed to handle are the following: , The problem here is that the input:
TAG : c
Date : January 10 2021, 02:04 PM , By : Matt Watson
Is 0x9B (155decimal) a special control character? Why is it missing from ascii tables?
Is 0x9B (155decimal) a special control character? Why is it missing from ascii tables?
I think the issue was by ths following , In ANSI escape sequences, 0x9B is the one-character Control Sequence Introducer (the multi-character version which is more familiar is ESC-[.
TAG : c
Date : January 10 2021, 01:57 PM , By : vitorcoliveira
windows C system call with spaces in command
windows C system call with spaces in command
Hope that helps Edit: OK, figured it out by stepping into the system() call: you need an extra set of quotes around the whole thing due the fact that it internally calls cmd /c yourinputSo this works for me:
TAG : c
Date : January 10 2021, 01:57 PM , By : SachinJadhav
FFmpeg C API documentation/tutorial
FFmpeg C API documentation/tutorial
Any of those help I've been keeping the Dranger ffmpeg tutorials up to date here: https://github.com/mpenkov/ffmpeg-tutorialI've tried to keep the code changes minimal while fixing bugs and rewriting deprecated parts.
TAG : c
Date : January 10 2021, 01:57 PM , By : arbeitandy
Thread scheduling Round Robin / scheduling dispatch
Thread scheduling Round Robin / scheduling dispatch
I hope this helps . First, the OS is the only entity in your system that can actually schedule your threads to run. The most common schedulers in newer Linux kernels are static-priority FCFS and RR, as well as the SCHED_OTHER scheduler, now implement
TAG : c
Date : January 10 2021, 01:57 PM , By : hammer_1968
Define integer ranges in C
Define integer ranges in C
I hope this helps . You can't, C has no such functionality. You can of course typedef an int:
TAG : c
Date : January 10 2021, 01:57 PM , By : user179190
feof() in C file handling
feof() in C file handling
I hope this helps you . If you're reading a byte at a time, the idiomatic way to do this is with fgetc:
TAG : c
Date : January 10 2021, 01:49 PM , By : dormsbee
How to check for signed integer overflow in C without undefined behaviour?
How to check for signed integer overflow in C without undefined behaviour?
With these it helps Integer overflow is the canonical example of "undefined behaviour" in C (noting that operations on unsigned integers never overflow, they are defined to wrap-around instead). This means that once you've executed x + y, if it overf
TAG : c
Date : January 10 2021, 01:49 PM , By : Jµ.
Display processes that access a folder
Display processes that access a folder
may help you . I'm not sure if there's an easier way, but one way is to use a file system filter driver. Or easier a file system minifilter driver.You can filter, log, track, control, ... all IO.
TAG : c
Date : January 10 2021, 01:49 PM , By : clifton anderson
How to printf a time_t variable as a floating point number?
How to printf a time_t variable as a floating point number?
it fixes the issue The resolution of time_t is at most one second on most platforms. That is, on most platforms, time_t will be an integer (32- or 64-bit) value counting the number of seconds elapsed since midnight of Jan 1st 1970 (UTC), and can only
TAG : c
Date : January 10 2021, 01:49 PM , By : Ben Humphrys
Parenthesis operator in C. What is the effect in the following code
Parenthesis operator in C. What is the effect in the following code
this one helps. If the function name is missing, as in your first example, then it is not a "parenthesis operator". It is simply a syntactic element of an expression that alters the association between operators and operands. In this case it simply d
TAG : c
Date : January 10 2021, 01:49 PM , By : Steve Jones
Is there table with timing(cost) of C functions?
Is there table with timing(cost) of C functions?
To fix the issue you can do Considering modern C compiler optimize like crazy, I think you'll find timings to be very situationally dependent. What would be a slow operation in one situation might be either optimized away to a faster operation, or th
TAG : c
Date : January 10 2021, 01:49 PM , By : Debashree
How can I access a global pointer outside of a C function?
How can I access a global pointer outside of a C function?
I hope this helps . I am trying to access the data of*tkn within a different function in my program for example: putchar(*tkn); It is a global variable but its not working correctly. Any ideas? , In this line:
TAG : c
Date : January 10 2021, 01:47 PM , By : user135518
Are fopen/fread/fgets PID-safe in C?
Are fopen/fread/fgets PID-safe in C?
I wish did fix the issue. On Linux, it's perfectly safe for multiple processes to simultaneously read from a file.
TAG : c
Date : January 10 2021, 01:47 PM , By : user119413
How can multiple variables be passed to a function cleanly in C?
How can multiple variables be passed to a function cleanly in C?
it should still fix some issue Using a struct with a pointer to it is really a good bet. The code may be a little longer to write, but it will look nice. You can pass a struct by value, but pass by reference will avoid copying the data.Another altern
TAG : c
Date : January 10 2021, 01:47 PM , By : jazzyfox
How to use pthread_atfork() and pthread_once() to reinitialize mutexes in child processes
How to use pthread_atfork() and pthread_once() to reinitialize mutexes in child processes
this one helps. Congratulations, you found a defect in the standard. pthread_atfork is fundamentally unable to solve the problem it was created to solve with mutexes, because the handler in the child is not permitted to perform any operations on them
TAG : c
Date : January 10 2021, 01:45 PM , By : Jack
Find function call in a list of binaries
Find function call in a list of binaries
this one helps. You can use the nm utility in conjuction with grep to find which executables reference the symbol, like so:
TAG : c
Date : January 10 2021, 01:45 PM , By : terrestrial
How to return a single variable from a CUDA kernel function?
How to return a single variable from a CUDA kernel function?
will help you I've been using __device__ variables for this purpose, that way you don't have to bother with cudaMalloc and cudaFree and you don't have to pass a pointer as a kernel argument, which saves you a register in your kernel to boot.
TAG : c
Date : January 10 2021, 01:45 PM , By : shehan
How to get number of cores in Win32?
How to get number of cores in Win32?
I wish this helpful for you You can call the GetSystemInfo WinAPI function; it returns a SYSTEM_INFO struct, which has the number of processors (which is the number of cores on a system with multiple core CPUs).
TAG : c
Date : January 10 2021, 01:45 PM , By : Richard
Handling aces and finding a segfault in a blackjack program
Handling aces and finding a segfault in a blackjack program
fixed the issue. Will look into that further To fix your segfault, use scanf("%d",k); instead of scanf("%d",k); (note the ampersand that I added. You need that because scanf's second argument is a pointer to the location where it should store what ge
TAG : c
Date : January 10 2021, 01:45 PM , By : Nick Coats
function prototype declarations
function prototype declarations
To fix the issue you can do Firstly, there's no requirement in C language to provide a prototype for a function before it is called. In C99 version of the language there's a requirement to declare a function before it is called, but still there's no
TAG : c
Date : January 10 2021, 01:45 PM , By : arbeitandy
How to convert from Hex to Decimal using only Integers in C
How to convert from Hex to Decimal using only Integers in C
wish help you to fix your issue Given int x that contains 8 bits that represent a number using natural packed binary-coded decimal, they can be converted to the number with:
TAG : c
Date : January 09 2021, 02:14 PM , By : Vorinowsky
How to parse from char array using yacc?
How to parse from char array using yacc?
I hope this helps . I am trying to parse string from buffer. ,
TAG : c
Date : January 09 2021, 02:14 PM , By : Tim Coffman
I can not work with linked list inside linked list
I can not work with linked list inside linked list
hop of those help? Using two structs in each other for linked list of linked lists makes it clear:
TAG : c
Date : January 09 2021, 05:38 AM , By : user160048
Finding the index of largest number
Finding the index of largest number
To fix this issue As "Some programmer dude" mentioned in the comment, if your purpose is to just find the index of the largest value, you don't need to implement insertion or any other algorithm to sort the array. You can probably make a function lik
TAG : c
Date : January 09 2021, 05:38 AM , By : gopal
Decompose a number to product of prime numbers and print it like 18=2*3^2
Decompose a number to product of prime numbers and print it like 18=2*3^2
it fixes the issue i have to make a program which decompose numbers into primes and prints it like 18=2*3^2 , We, beginners, should help each other.:)Here you are.
TAG : c
Date : January 08 2021, 10:52 AM , By : algoRhythm99
programming EXACT timer which calles a function in c language every x seconds
programming EXACT timer which calles a function in c language every x seconds
I wish this help you I need some help with a part of my Programm. I want to call a function EXACTLY every x seconds. The problem with the most soultions is, that the time to call the sleep() or w/e function stacks over time.
TAG : c
Date : January 08 2021, 10:52 AM , By : user152319
Combining macros generate errors
Combining macros generate errors
I hope this helps you . I want to generate the name of an AVR interrupt vector with the C preprocessor and with a given interface name. So I have this configuration file (Config.h) which is included to another header file. , The problem is "clearly"
TAG : c
Date : January 08 2021, 10:52 AM , By : woxorz
Why am I not getting error when I store values of different types in an array in C language?
Why am I not getting error when I store values of different types in an array in C language?
it fixes the issue In C, character literals are of type int See C11 Character constants which says "¶2 An integer character constant is a sequence of one or more multibyte characters enclosed in single-quotes, … — ¶10: An integer character constant h
TAG : c
Date : January 07 2021, 03:08 PM , By : Keniwan
What is the purpose of the base case dp[0] = -1 of this DP array in the palindromic partitions problem?
What is the purpose of the base case dp[0] = -1 of this DP array in the palindromic partitions problem?
Any of those help This a guard value. We use such things when we don't want to write additional ifs, then we append some guard elements to the data, e.g. instead of n*n matrix we might use (n+2)*(n+2) matrix with some convenient values in guards posi
TAG : c
Date : January 07 2021, 07:50 AM , By : Jonathan Bernard

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