Code Forum » C Programming
71 FOLLOWERS
Code Forum is a community of coders, designers, and creators of all sorts. This section gets you tutorials, guides related to C programming, offers you space to ask questions, and much more.
Code Forum » C Programming
2M ago
I'm trying to understand the code here
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
Accept third party cookies
View: https://www.youtube.com/watch?v=NLKQEOgBAnw&t=443s
I don't understand this notation:
(x&(1<<i)) != 0
I understand we want to AND the bit at i position with 1, and see if it's equal to 1. So i assume that's what the formula is doing. Is this C code?
& must mean AND
i must be the position, 6 in the example: (x&(1 << 6)) != 0. Correct?
What's x?
What's...
Read more ..read more
Code Forum » C Programming
3M ago
Code:Copy to clipboard
#include <stdint.h>
typedef int(*ptr)();
int X(ptr P, ptr I)
{
P(I);
return 0;
}
int Y(ptr P)
{
X(P, P);
return 1;
}
int main()
{
X(Y, Y);
}
Does this criteria prove that Y calls X in infinite recursion?
An examination its x86 machine language proves that Y calls X with its same parameters and there are no conditional branch instructions between the invocation of Y and its call to X.
Code:Copy to clipboard
_X()
[00001cf3] 55 push ebp
[00001cf4] 8bec mov ebp,esp
[00001cf6] 8b450c mov...
Read more ..read more
Code Forum » C Programming
3M ago
This recent update has academic support, (two computer science professors with similar views are quoted).
https://philpapers.org/archive/OLCCRR.pdf ..read more
Code Forum » C Programming
3M ago
Is there any code for communication between c and javascript ..read more
Code Forum » C Programming
4M ago
In the text file numbers.txt there is a series of integers separated by commas. Assume that the file is formatted correctly (no letters, spaces, etc., no commas after the last number). However, there is one small problem: these numbers can be significantly larger than the largest value that can be represented by the int type, and even long long can also be negative.
It is necessary to create a program that reads numbers from a file, finds the largest number in the file, and prints it on the...
Read more ..read more
Code Forum » C Programming
4M ago
I'm tackling the credit problem from cs50 and I'm baffled by the for loop on one section because I'm dividing a long integer 4003600000000014 by 100 and it returns a large negative number -1685133312.
Here is the actual code:
Code:Copy to clipboard
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
long int number;
long int temp;
do
{
number = get_long("Number: ");
} while (number < 0);
temp = number;
int counter = 1;
for (int i = 10; i <=...
Read more ..read more
Code Forum » C Programming
4M ago
Hello, everybody! I'm Lucas. This is my first post here. I signed up several days ago, but that day my connection was awful and couldn't post anything, so I'm here today to introduce myself and to make the question that led me to search for a C programming forum, which took me here
The thing is this. I love C language because it's widely used, very clear and not too high level. It's also easy to compile almost everywhere. The problem is this comes at a cost. C has always refused to...
Read more ..read more
Code Forum » C Programming
5M ago
Welcome to the Virtual Food Donation Drive with Categories!
Day 1:
Current count - Grains: 0, Fruits: 0, Vegetables: 0
Select a category (G for Grains, F for Fruits, V for Vegetables): G
Enter the number of food items donated in the selected category: 10
... [repeats for 5 days]
Current count - Grains: 40, Fruits: 25, Vegetables: 15
Goal has NOT reached for all categories. Please continue donating.
Select a category (G for Grains, F for Fruits, V...
Read more ..read more
Code Forum » C Programming
5M ago
Hi everyone!
I am very new to C programming having only started in September. I am trying to write a program that takes in n numbers of non-negative integers, places them into a dynamic array that grows in length as necessary and then uses a function to sort them in order of increasing size and print. I am trying to use a for loop to store each entry into the array and I have used an if condition in order to try and double the size using realloc as necessary. I understand the concept but I...
Read more ..read more
Code Forum » C Programming
6M ago
I made my own version of this task, but it does not return to its original position as required in the task, please help me complete this task
Code
The barriers on which are differently wide and differently high, located at random distances from each other. Now Karel will have to pick up the badges on the way back to the original position, again overcoming the obstacle course on the way back. Also don't forget that you still can't use
sites.google.com ..read more