Integer variable starts at 1024?
Go4Expert » C
by klattz
3M ago
I am following code academy's path to learning c and ran into a weird issue. When running my code the variable "a" has an initial variable of 1024? Can someone help me uderstand or lead me in the right direction to crafting a better google query? Very new to the language so all feedback is greatly appreciated. Ignore my awful code and random comments. I was trying to troubleshoot the error and went all over the place. Code: #include<stdio.h> #include<string.h> int main () { int... integer variable starts at 1024 ..read more
Visit website
How to convert circular linked list into singly linked list?
Go4Expert » C
by Tabb1us
2y ago
First, I create a circular linked list that looks like this: Code: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> (head) Now I'm attempting to convert this circular linked list into a singly linked list, which is the desired result. I'm attempting to eliminate circularity by substituting null for (head). Code: 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> null This is my code: Code: public class Main { class Node { Integer data; Node next; Node(Integer data)... How to convert circular linked list into singly linked list ..read more
Visit website
Segmentation Fault (SIGSEGV) in C
Go4Expert » C
by Thaus015
2y ago
I am relatively new on C, I am trying to run a program and I get this Error message: Segmentation fault (core dumped) I just want to print any value of the array bits but I can not, I'd appreciate any help on this error. Code: #include <stdio.h> #include <math.h> #define COL 204 #define COL_P 2 #define ROWS_P 1020 int codecheck(int (*h)[2],int x[]) { int i,j,m,f; //flags int sum = 0; int y[COL]; for (i=0;i<COL;i++) y=0; m=1; f=-1; for(i=0;i<ROWS_P;i++)... Segmentation Fault (SIGSEGV) in C ..read more
Visit website
Why do i get overflow?
Go4Expert » C
by SaKaMoToSaN15
2y ago
Here is my code: Code: #include <stdio.h> #include <stdlib.h> #define ROWS_LENGHT 10 void inputNums(int timesTable[][ROWS_LENGHT]); void printTable(int timesTable[][ROWS_LENGHT]); int main() { int timesTable[ROWS_LENGHT][ROWS_LENGHT] = {0}; inputNums(timesTable); printTable(timesTable); return 0; } void inputNums(int timesTable[][ROWS_LENGHT]) { int i = 0; int j = 0; for(i = 1 ; i <= ROWS_LENGHT ; i++) { for(j = 1 ; j <= ROWS_LENGHT ; j++)... why do i get overflow ..read more
Visit website
Multiple Bouncing Balls Program in C (Please Help)
Go4Expert » C
by Jimmysl
2y ago
I am trying to make a program in C with multiple bouncing balls. I know it is a very known program and I have already searched the internet and seen different versions of it. However, because I am new in programming, I didn’t manage to understand them and answer my questions. The problem is that I have created a code, but my program doesn’t run properly. To be more exact, I think the part where it reads the data is fine, but then there is a problem in the code of the graphics.h library. I... Multiple Bouncing Balls Program in C (Please Help ..read more
Visit website
Reverse string
Go4Expert » C
by senthil_a4nlabs
2y ago
give me the c prograame for reverse string ..read more
Visit website
How to subtract the same number from an array
Go4Expert » C
by Guilherme Romero
2y ago
I'm doing an exercise of which statement is below: You are responsible for a rail convoy of goods consisting of several boxcars. You start the train and after a few minutes you realize that some boxcars are overloaded and weigh too heavily on the rails while others are dangerously light. So you decide to stop the train and spread the weight more evenly so that all the boxcars have exactly the same weight (without changing the total weight). For that you write a program which helps you in... How to subtract the same number from an array ..read more
Visit website
Showing mean and variance
Go4Expert » C
by Guilherme Romero
2y ago
Hello! I'm writing a program that calculates and shows the mean and variance of two integers. The result I'm getting is 7. But that's not the mean of 5 and 10 (num1 and num2). What can I do to show both mean and variance together on the screen? What should I put after return to show both mean and variance? Thank you. Code: #include <stdio.h> double statistics (int x, int y){ double mean, var; mean = (x+y)/2; var = ((x-mean)*(x-mean) + (y-mean)*(y-mean)) /2; return... Showing mean and variance ..read more
Visit website
Passing a 2d array to a function, using the pointer to a 2D array
Go4Expert » C
by Dragu Mircea
2y ago
Hi, I am trying to make a program, a read from the keyboard a 2d array and print his elements. It works, but i am not so sure is very good, because when i compile, take a while and it finish with a delay. When I make debug I obtain a segmentation fault. So, I need some help. Thank you in advance. #include <stdio.h>​ #define ARRAY_ROW 3 #define ARRAY_COL 3​ void WriteArray3(int(*piData)[ARRAY_ROW][ARRAY_COL]) { int iRow = 0;...​ Passing a 2d array to a function, using the pointer to a 2D array ..read more
Visit website
Array printing help needed
Go4Expert » C
by steve walker
2y ago
I have a program to create and fill a 2 dimensional array with numbers up to 2**8 in the first column, and the binary equivalent in the next 8 columns. When I print the array twice, as in the program, I get the results expected. But if I print the array only once, using the goto skipprint statement, I get all ones. The program works for Bits equals 3 through 7, but when Bits = 8, it fails unless I print the array twice. Very frustrated, as I'm missing some nuance, and I can't find any... Array printing help needed ..read more
Visit website

Follow Go4Expert » C on FeedSpot

Continue with Google
Continue with Apple
OR