Yes, the problem did go away after I fixed the initialization.
Appreciate the second pair of eyes to look over my dumb mistakes.
Thanks!
Type: Posts; User: slee8251
Yes, the problem did go away after I fixed the initialization.
Appreciate the second pair of eyes to look over my dumb mistakes.
Thanks!
#include <stdio.h>#include <stdlib.h>
typedef struct node
{
void* dataptr;
struct node* next;
} NODE;
#include "queue.h"
QUEUE* CreateQueue(void)
{
QUEUE* queue;
queue = (QUEUE*)malloc(sizeof(QUEUE));
I am using the STACK ADT which means the data values in the stack are void pointers.
I am having trouble trying to push strings into the stack because of these void pointers.
I understand how...
This was an exam problem that I still don't really understand
int main ()
int a[10] = {1,2,3,4,5,6,7,8,9,10};
int *ptr = (int*)(&a + 1);
printf("%d %d, *(a+1), *(ptr-5) );
return 0;
to clear things up, this is a specific pgm file that I have written code for. I know for a fact the header text goes like this:
P5\n
3039 2014\n
255\n...
Windows OS
typo: Because I start reading the image at the 20 byte position, my fread returns value of 6120543 and I malloced 6120546.
I need to read in a pgm file. Ive determined using ClikView that the image is 6120546 (3039 x 2014) and the total file size is 6120563. Therefore, I know the header file is 17 bytes total.
...
I am writing a program where the user inputs a string and have to make the string "dance" based on a rhythm they also input.
rhythm 2 : *_*_*_*_ etc.. (where star is capitalized and _ is lower...
#define taxRate .06#include <math.h>
float legalInput( float minimum );
float roundUpToPenny( float amount );
void makeChange ( const float denoms[], int n, float tend, float cost );
oh man, i feel so dumb, lol
void printoutput(const float prices[], const char taxable[], const int lines)
{
int i;
puts("Price Taxable");
puts("----- -------");
for(i = 0; i<=lines; i++){
so is the lesson i should take from this is to never use floats and doubles in the same program? use one or the other?
because i changed all my doubles to floats and now i get the right answer. ...
This program is intended to read numbers into an array and to count how many positive, negative numbers there are and to also calculate the total for each category and calculate the average.
...
yea it was either doing that or Principle = 0.00;
do you have any other suggestions?
what i was talking about with the rounding error is that say you have a 1000 loan at a rate of 0.125 and a...
#include <stdio.h>
int main (void)
{
double principle;
double annual_rate;
double monthly_rate;
double interest_accrued;
double...
I wrote the a program that displays a table with the interest, payment, new balance, etc. for every month. However, I am getting rounding issues somewhere in the middle of the calculation making the...
ahhh thanks you
Can someone tell me what I am mis-understanding or if there is something I need to do? My code is this:
#include <stdio.h>
int main (void)
{
int diameter=1;
double radius;
printf("enter...
ahh okay thanks.
so if you do (4.0/3.0) it should work, right?
Can someone please explain the difference between the two, given the same radius? They produce different results. Thanks in advance
#define PI 3.1416
volume = (4*PI/3)*pow(radius,3);
volume...
I'm beginner to programming in general.
Say I have:
int x = 80;
int y = 6;
double average;
average = x / y;
printf("%f", average);