C programming Definition and 115 Threads
-
Runtime of Seemingly Unpredictable Division Algorithm
Last week on my computer science assignment I had to write a division algorithm using only addition and subtraction to tackle a problem. My first attempt was the simple and naive repeated subtraction, although I quickly discovered it was not nearly efficient enough for how I needed to use it, So...- matineesuxxx
- Thread
- Algorithm C programming Division Runtime
- Replies: 7
- Forum: Programming and Computer Science
-
A
C Programming: acos() not accepting variable
The following function acos() does not accept any variables. I have included the math.h header. For example i = 1; acos(i/2); // This should be equal to 60- angelspikes
- Thread
- C programming Programming Variable
- Replies: 12
- Forum: Programming and Computer Science
-
Enrollment in C programming course
I've decided to learn programming in my holidays. And I've enrolled myself in a C programming class (Apparently they don't allow C++ unless you know C). The course requirement says familiarity with "programming techniques" I tried searching it but I din't get the meaning I just got various...- Giant
- Thread
- C programming Course enrollment Programming
- Replies: 21
- Forum: Programming and Computer Science
-
N
C programming: pointer assignment only in main()?
Hello, I was assigning a pointer to an array and I noticed it will only this to takeplace within the main function: #include <stdio.h> float array_1[10] = { 1,1,2,3,4,5,6,7,8,9 }; float * p_array_1; int main( void ) { p_array_1 = &array_1; printf("array address using ampersand is %p...- nobahar
- Thread
- Assignment C programming Programming
- Replies: 9
- Forum: Programming and Computer Science
-
N
C programming: array declared before main() and initialised in main()
Hello! I am sure I am again missing something obvious: I tried to declare the array and assing value within main() as follows: #include <stdio.h> float array_1[10]; int main( void ) { array_1[10] = { 1,1,2,3,4,5,6,7,8,9 }; ...other stuff... return 0; } I can declare and...- nobahar
- Thread
- Array C programming Programming
- Replies: 9
- Forum: Programming and Computer Science
-
N
Simple C programming problem, variable stuck at initialised value
Simple C programming problem, variable "stuck" at initialised value Hello! This is most likely an error in my code but I just can't see what it is! I am new to C programming and maybe I have just been staring at it for so long that I can't see the obvious error. I was playing around with a...- nobahar
- Thread
- C programming Programming Stuck Value Variable
- Replies: 2
- Forum: Programming and Computer Science
-
A
Top C Programming Books for Beginners: Expert Recommendations
Hi, could anyone recommend me a good book for learning C programming? I know that there are lots of good website but I would prefer a solid book, however without reading them before hand naturally I can't determine a good one! So any advice on this specifically would be good thank you. Or any...- AlexVGheo
- Thread
- C programming Programming
- Replies: 14
- Forum: Science and Math Textbooks
-
B
A problem when calculating the average of an array (c programming )?
hi , I need to do the following Write a program that asks the user to enter a number. Then create an array of this size. Fill the array with random numbers between 0 and 10. Calculate the average value. I did the program but there is a problem in calculating the average . can some one tell me...- blue_tiger30
- Thread
- Array Average C programming Programming
- Replies: 6
- Forum: Programming and Computer Science
-
J
Create Custom Shapes with User Input in C Programming
I have to write a program that will take user input to make certain shapes. If the user inputs 's', its a solid square, 'b', its a hollow box, 't' its a triangle. They also choose how many rows it is and what the shape is made of. Example **** **** **** this would be a user input of...- jaydnul
- Thread
- C programming Programming
- Replies: 4
- Forum: Engineering and Comp Sci Homework Help
-
J
Print Text After Scanf on Same Line in C Programming
How do you print text after a scanf statement on the same line? This is what i need the output to look like: Enter a number here: _% The _ is the scanf waiting for input. Now when i write the code like this: printf("Enter a number here: "); scanf("%d", &x); printf("%\n"); It won't...- jaydnul
- Thread
- C programming Programming
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
J
Output JBL in Block Letters with C Programming
All i have to do is write a program that will output my initials (JBL) in block letters. This is what i have done: #include <stdio.h> void main() { printf(" JJJJJJ BBBBBBBB LLL"); printf(" JJ BB BB LLL"); printf(" JJ BBBBBBB LLL"); printf(" JJ BB...- jaydnul
- Thread
- C programming Programming
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
J
A few questions about C programming language
1. In what direction does a compiler read a program? Left to right, top to bottom? 2. What does it mean when a function is called by another. Like when main() is called by the operating system, what is going on within the computer? Does the OS send a code in binary or what? 3. When the...- jaydnul
- Thread
- C programming Language Programming
- Replies: 3
- Forum: Programming and Computer Science
-
S
Basic C Programming Help Cash Register
Hello, I am working on a basic cash register c program and I've run into a few errors/logical errors I don't know where to begin to fix. I am limited to knowing only how to use, scant, printf, if/elseif/else, do/dowhile. The problem is if you compile it and test it, my validcode flag is not...- Saterial
- Thread
- C programming Programming
- Replies: 21
- Forum: Programming and Computer Science
-
F
C Programming with Interrupts: How to Avoid Polling and Optimize Processor Usage
Hi everyone~ I think that I have used polling here where I shouldn't have done. Does anyone have any ideas? #include "p18f8722.h" #include "timers.h" void configure_PB2_interrupt (void); void enable_global_interrupts(void); unsigned char PB2_pressed (void); void isr...- fractal01
- Thread
- C programming Programming
- Replies: 7
- Forum: Engineering and Comp Sci Homework Help
-
F
When to use ADCON1 in c programming on the pic18f8722
Under what circumstances would you use ADCON1=0x0F? All I know at the moment is for using the pushbuttons and using the switches and then I saw a piece of code using the pushbuttons without this line in it and I was wondering whether I was wrong all of this time. I have tried googling and...- fractal01
- Thread
- C programming Programming
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
A
C Programming: Dynamic allocation of 2D arrays using an array of pointers.
Homework Statement Ok, I'm learning C programming and I'm trying to create a dynamic 2D array. This is the code that seems to work in creating a dyamic array. I found it in a book. //rows and cols are values entered by the user when the program runs. int **(matA) =...- ashwinnarayan
- Thread
- 2d Array Arrays C programming Dynamic Pointers Programming
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
C
C Programming: Creating recursive quickSort function
Homework Statement Function: void quickSort(struct student *array, int start, int end) { int i = start; int j = end; while(i < j) { // Move left counter, then right counter. while(i <= end && array[i].numDays <= array[start].numDays) i++; while(array[j].numDays >...- cubanmissile
- Thread
- C programming Function Programming
- Replies: 5
- Forum: Engineering and Comp Sci Homework Help
-
C
C Programming: freeing array of structs causes heap overflow
Homework Statement Error: warning: HEAP[Happy Birthday.exe]: warning: Heap block at 006E15A8 modified at 006E1688 past requested size of d8 My Struct: struct student { // Defines a student. char firstName[NAMELENGTH], lastName[NAMELENGTH]; int day, month, year; }; My Code...- cubanmissile
- Thread
- Array C programming Programming
- Replies: 5
- Forum: Engineering and Comp Sci Homework Help
-
S
Python C Programming: Deepen Understanding & Learn Python in 1 Month
Im a Computer Science Major, i just finish a programming Class.. it was a C class, i got an A on the class it was a bit to easy in my opinion, but I am not confident in C Im good with functions, variables, pointers, basic structs, etc Im lacking understanding on structs using pointers...- SuperMiguel
- Thread
- C programming Programming Python
- Replies: 1
- Forum: Programming and Computer Science
-
D
C programming compiling syntax errors
Got some errors when compiling and not sure what is the problem and how to fix it # include<stdio.h> #define FLEETSIZE 10 typedef struct { int day, month, year; }Date_t; typedef struct { char make[15]; Date_t manufactureDate; Date_t...- dudforreal
- Thread
- C programming Errors Programming
- Replies: 22
- Forum: Programming and Computer Science
-
Y
How to write a C programming proposal?
I'm new at C programming. My course required me to write a proposal with the title "Word Processing'. It sounds: Create an interface that emulates basic word processing. Ask the user to input text and save it to "txt" format. The user should be able to modify, add and remove any of the...- yukari1310
- Thread
- C programming Programming
- Replies: 18
- Forum: Programming and Computer Science
-
Orbit program - three objects (C programming, but other programmers could help)
Homework Statement I'm trying to write a program with three bodies, two in orbit around a large central object. The main object orbits fine, that was dealt with earlier. I'm having trouble making a smaller object that is the only object whose position is dependent on the position of both of...- Who Am I
- Thread
- C programming Orbit Program Programming
- Replies: 6
- Forum: Introductory Physics Homework Help
-
S
Why Do CPUs Handle Signed and Unsigned Arithmetic Differently?
I'm completely lost, I have an exam in C programming in a month & a half based off of this: http://www.maths.tcd.ie/~odunlain/1261/prog.pdf Basically I need some recommendations of books &/or online resources that follow the flow of those notes extremely closely but offer additional insight...- sponsoredwalk
- Thread
- C programming Programming
- Replies: 26
- Forum: Programming and Computer Science
-
C
Executing more than one command in C programming at the same time, newbie in C.
Hello all, I'm doing a project related to counting up the amount of production. I'm using Arduino board and C language. I am counting the amount of production in 3 line in the factory. So far I have design the program only for 1 line, how to make the 2nd and 3rd lines so at the end I can sum...- creativen
- Thread
- C programming Programming Time
- Replies: 12
- Forum: Programming and Computer Science
-
J
Late Dennis Ritchie: Creator of C Programming Language
Dennis Ritchie died on the 8th, but I didn't find out until today. He created the C programming language. http://www.wired.com/wiredenterprise/2011/10/dennis-ritchie/"- Jimmy Snyder
- Thread
- C programming Language Programming
- Replies: 21
- Forum: General Discussion
-
P
Counting characters in C language
Please explain what this C code will do : #include <stdio.h> /* count characters in input; 1st version */ main() { long nc; nc = 0; while (getchar() != EOF) ++nc; printf("%ld\n", nc); } 'The C Programming' Book says that this code counts characters but it doesn't do the same ...- physics kiddy
- Thread
- C programming Programming
- Replies: 9
- Forum: Programming and Computer Science
-
P
What is EOF in C Programming Language?
Can anyone please explain what is EOF in C programming language. Is it a value (numeric, character) or something else ?? While reading the book "The C programming language", by Ritchie I came across this term. The code was : [FONT="Fixedsys"]#include <stdio.h> /* copy input to output...- physics kiddy
- Thread
- C programming Language Programming
- Replies: 15
- Forum: Programming and Computer Science
-
M
C Programming: Simulate Program to Calculate xxx(17)
Homework Statement Simulate the following program #include <stdio.h> int xxx (int n) { int count; count = 0; while ( n >=2) { n = n/2; ++count; } return count; } main() { printf( "xxx(17)=%d\n", xxx(17) ); } Homework Equations The Attempt at a...- Maybe_Memorie
- Thread
- C programming Programming
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
M
C Programming: Simulate xxx(333) = 2
Homework Statement Simulate the following program #include <stdio.h>int xxx ( int n ) { if ( n < 10 ) /* A */ return 0; else return 1 + xxx ( n/10 ); /* B */ } main() { printf ( "xxx(333)=%d\n", xxx(333) ); } Homework Equations The Attempt at a Solution I'm not sure if this is...- Maybe_Memorie
- Thread
- C programming Programming
- Replies: 22
- Forum: Engineering and Comp Sci Homework Help
-
M
Evaluate C Programming Questions: 1-2/3+4-5, 1-2/3+4.0-5 etc.
Homework Statement Evaluate the following expressions (i) 1 - 2/3 + 4 - 5 (ii) 1 - 2/3 + 4.0 - 5 (iii) 1 - 2/3.0 + 4 - 5 (iv) 1 + 4*3/2 (v) 1 + 3/2*4 (vi) 'h' - 'e' + 'l' - 'p' The Attempt at a Solution The answers for each question respectively are 0 0.0...- Maybe_Memorie
- Thread
- C programming Programming
- Replies: 7
- Forum: Engineering and Comp Sci Homework Help
-
A
Variables suddenly disappering (C programming)
Hi, I have an array that is partially disappearing from one line of code to the next and I don't have idea what could be causing this. The pseudocode of the relevant chunk of code goes like this: ... declare some 3d-dynamic arrays allocate memory for the arrays assign values to the...- andresordonez
- Thread
- C programming Programming Variables
- Replies: 3
- Forum: Programming and Computer Science
-
S
Learn How to Use File and Argc in C Programming: Step-by-Step Guide
Hello! I am learning how to use file and argc and I am stuck on this assignment : write a program that sequentially displays on screen the contents of all of the files listed in the command line. Use argc to control a loop. Here is my code, I'll try to enclose it in [ CODE ] [ /CODE ] tags if...- stellina
- Thread
- C programming Programming
- Replies: 15
- Forum: Engineering and Comp Sci Homework Help
-
M
Java Comparing Java & C Programming: Questions & Answers
So I have multiple questions regarding these two programming languages. 1. Which is better to learn first? 2. I recently emailed a possible future university asking what languages they teach. In the email he said "Java rafter than C" Now does that mean mostly Java but C included? Or no C at...- Monster92
- Thread
- C programming Java Programming
- Replies: 18
- Forum: Programming and Computer Science
-
J
C programming Q: initializing an array of structures
I am writing a program in C (vanilla, non-C++/C#) and I am having trouble figuring out why my initialization of my array of structures isn't working. I have tried a number of things without any luck. I still get a compiler error: "conflicting types for 'cardInfo' " I am writing a simple...- jjc
- Thread
- Array C programming Programming Structures
- Replies: 6
- Forum: Engineering and Comp Sci Homework Help
-
U
C Programming: Output of Float Calculation
The question is What will be the output? #include<stdio.h> int main(void) {float y=6/4; printf("%.1f\n",y);} The answer is 1.0 I got that right by trusting my senses:biggrin:; but I want to understand why.- ubuntu2
- Thread
- C programming Float Programming
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
S
Understand the Output of 1000*1000 in C Programming
Hello, I want to know the answer of following program and the reason behind it...as soon as possible void main() { float j; j=1000*1000; printf("%f",j); }- sunakshi
- Thread
- C programming Output Programming
- Replies: 9
- Forum: Programming and Computer Science
-
C
C Programming for Mechanical Engineers: Benefits & Applications
Is C programming language necessary for Mechanical Engineers? Why? And where we use it?- C.KIRANKUMAR
- Thread
- Applications C programming Mechanical Programming
- Replies: 5
- Forum: Mechanical Engineering
-
R
Multiplying Columns of Numbers in C Programming
Hello all, I wrote a C program to multiply a column of numbers (for eg., number will look like this 10.45618) with some constant... after multiplication i get the correct value (i tested using calculator). Now the output is 0.00005672 (i use %14.9lf) ..but i want them to display like this...- Rajini
- Thread
- C programming Columns Numbers Programming
- Replies: 2
- Forum: Programming and Computer Science
-
H
The Next Step in Learning C Programming: Suggestions & Resources
Hello every body! I have read "The C Programming Language" and i want to know if i want to go further what is the next book you suggest?- hadi amiri 4
- Thread
- C programming Programming Resources Suggestions
- Replies: 1
- Forum: Programming and Computer Science
-
J
C Programming: Printing Prime Numbers from 1 to 20
Homework Statement Hello, i want to calculate and print prime numbers from 1 to 20. I've provided my code below, and the program compiles but its just printing all numbers from 1 to 20, why? also have i used the continue statement correctly, since if it is found that a number is not prime then...- jam12
- Thread
- C programming Numbers Prime Prime numbers Programming
- Replies: 11
- Forum: Engineering and Comp Sci Homework Help
-
L
What Can Function Prototypes Do Without Parameters and Return Values?
Just some basic questions i have about function prototypes (functions) What's an example of a code which has no parameters? ie: double func(void) what is the purpose if the thing doesn't take in parameters? also, what if there is keyboard input and screen input what does that mean in the...- Luongo
- Thread
- C programming comp sci Programming
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
K
C Programming: give command a 5 sec interval to run
Hi all, I am new to C and I need some help solving an issue with network programming. So in general, i have two programs running: Program A and Program B. Description of A: Send out packet with SN = i (SN is the label for the packet. i.e first pkt SN=1, 2nd pkt SN=2 etc) Set...- kcirtap
- Thread
- C programming Interval Programming
- Replies: 2
- Forum: Programming and Computer Science
-
I
C Programming: Adding 16bit and 32bit Integers with Local and Global Variables
Homework Statement Write a C program to use a function to add two 16bit and two 32bit integers together and return a long integer result. Call the function twice with different parameters and print the results. Declare your input variables to one of the function calls as local variables (on...- ineedmunchies
- Thread
- C programming Programming
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
C
Help in C Programming: Fixing Errors with nr.h & nrutil.h Libraries
What are the functions of the following C libraries? nr.h nrutil.h What I understood is that these are used when u are calling functions like 'qromb or polint or trapzd' for integration. Acutally when I compile the program I get these errors. nr.h: No such file or directory nrutil.h: No...- charlespune
- Thread
- C programming Programming
- Replies: 1
- Forum: Programming and Computer Science
-
V
Tips for Reading and Splitting Data in C Programming Lab Homework
Homework Statement Well the program has several functions but I just really need help with reading a text file and splitting the data in the file into a one-dimensional array and a two-dimensional array The text file is like this... 21 1110 1.5 5.4 6.0 9.8. 8.5 8.3 5.6...- vuongstran
- Thread
- C programming Lab Programming
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
N
What is the Correct Way to Initialize a Character in C Programming?
the foolowing program is to read inputed data and display them all at once but when i run it it asks for the first information and then runs the total program without asking for the input of other information.after that it doesn't respond and closes immediatelly. can someone help me and tells...- nard
- Thread
- C programming Programming Structures
- Replies: 2
- Forum: Programming and Computer Science
-
R
C programming help nedded ?what is the wrong of this code?
C programming help nedded ??what is the wrong of this code? #include<stdio.h> int matA[3][4],matB[4][3],matAB[3][3],i,j,k; void read(); void multiply(); void display(); int main() { read(); multiply(); display(); return 0; } void read() { printf("Enter your matrix A:\n"); for...- rclakmal
- Thread
- C programming Code Programming
- Replies: 8
- Forum: Programming and Computer Science
-
L
C Programming Compiler for Windows Vista
Hi, At university we are using the Borland C++ 5.5 compiler, however, this does not work on Vista, which my home computer has. I was therefore wondering what C program compiler everyone would recommend which works on Windows Vista? Thanks, Luke.- lukesowersby
- Thread
- C programming Compiler Programming
- Replies: 11
- Forum: Programming and Computer Science
-
Q
Converting Fahrenheit & Celsius: A C Programming Guide
Okay. I need to write a C program to convert between fahrenheit and celsius degrees.- queenspublic
- Thread
- C programming celsius Programming
- Replies: 3
- Forum: Programming and Computer Science
-
J
C programming Do – While loop problems
Hi, I have to build a program that will find the equivalent resistances in series and parallel of any number of resistances entered at the keyboard. So far i have this: [SIZE="3"] I really don't know where i went wrong. The value returned for RTS is the same value as the user entered...- JJ452
- Thread
- C programming Loop Programming
- Replies: 4
- Forum: Programming and Computer Science