i got my max and min to work, but i still need help with my gtr pointer, its still not returning the right value here is what i have.
function prototype
double average(int x[], int npts, int...
Type: Posts; User: belkins
i got my max and min to work, but i still need help with my gtr pointer, its still not returning the right value here is what i have.
function prototype
double average(int x[], int npts, int...
Below is my code. The problem I am having is that when trying to print out a value in the main function from a pointer in a function its giving me wacky values. Like for example my maximum value lets...
Oh i know what i did, thanks a ton. I got it to work!
like if the user types "The dog runs fast." and want to see how many times s occurs, it should return 2 but returns 0 instead.
ok so i modified it as
int occurance(char *str, char str2)
and fixed it so now its not giving me that error but now its not returning the right number, if i need to repost what i have i can if...
ok im an idiot i forget the &str, but i modified it and it asks the user but then it crashes?
i mean its not even letting the user type in a variable to initialize str2?
? a warning, i thought they werent a big deal. i mean i can do scanf_s but still? does scanf need to be something else?
and compiles fine but when i try to execute it i get a run time error saying str2 isnt being intialized??? does anyone know whats wrong
Heres what i have now after what i think fixing it the way you tell me to.
#include <stdio.h>
#include <string.h>
int main (void)
{
/*Declare and intialize variables*/
so where do i need to make changes in my program i tried on my own now it wont even work or crashes
may that was a little confusing, heres a newer version with comments except i moved my while loop into a function. so here it is
#include <stdio.h>
#include <string.h>
int main (void)
{...
Below is my program. It works but then it gives a run time check failure- stack around the variable 'str2' was corrupted. I have no idea what the deal is. Thanks
#include <stdio.h>
#include...
figured it out
k=(i*7)+j;
i dont think this is the right equation? it works for the first seven then messes up on the index, but the value of the index is correct, do you know of an equation that would fix this?
so k should be
k=(i +1) *(j+1) - 1
????
Yea i knew something was wrong because when i printed it out it was a mess, so does k need to be an outside loop?
i fixed the power1d
right it should be
fint i, j, k;
int power1d[56];
for(i = 0; i<NROWS; i++)
{
for(j=0; j<NCOLS; j++)
{
do i declare the 2-d array as one-d then
does another array need to be declared?
so does this work NROWS being 8 and NCOLS being 7
int i, j, k;
int power1d[56];
for(i = 0; i<NROWS; i++)
{
for(j=0; j<NCOLS; j++)
{
to make my self more clear in power[0][0] the value should be 253 but instead i get 0.0000000000
#include<stdio.h>
#include<math.h>
#define NROWS 8
#define NCOLS 7
int main (void)
{
FILE *input;
int i;
int j;
double power[NROWS][NCOLS];
ok ill go with the pointer