I knew about \0, bt I was under the assumption I would skip this character thanks to my pre-increment. Oh well, the program works perfectly now anyway.
Type: Posts; User: goodn
I knew about \0, bt I was under the assumption I would skip this character thanks to my pre-increment. Oh well, the program works perfectly now anyway.
Ok, now it's almost working.
#include <stdio.h>
#include <string.h>
#define SIZE 1024
int main()
{
#include <stdio.h>
#include <string.h>
#define SIZE 1024
int main()
{
char s[SIZE];
int i;
gets(s);
So I imagine i would want to make a loop like
for (i = strlen(S); i != 0; --i)
{
printf s[i];(I know that's not how the real code goes)
}
right?
Wow, that was incredibly easy.
Hi. For part of a code I'm making, I want to reverse strings.
.sgnirts esrever ot tnaw I ,gnikam m'I edoc a fo trap roF .iH
What I was thinking of doing is making a kind of bubblesort...
Um, thanks, but didn't you read? I just forgot the breaks. I know how switches work, I just simply forgot to put in my breaks. I edited my post to say that I found and corrected the problem. Your...
Hehe, I also had a couple errors, but I fixed those. Gues I should really look at my program for 5 minutes before deciding to ask for help!
Hey. i'm making this program right now, and I KNOW what the problem is, but I don;'t know what I did wrong. All the functions and everything work correctly, so no need to worry about those, but I'm...
sory,
windows 98, jGrasp
I got a test file and a header file. I made the header file.
My friend made the test file. theoretically, my header file SHOULD work for it!(his file has no errors, and his header file(which used...
Problem solved.
isum
This function will take an integer array of numbers and the array size as its parameters.
It will return the sum of all the numbers in the array as an integer.
dsum
This function will...
Heh, my professor has done the same thing on his web page! Shame on him!
Ok, thanks. One other thing, it seems a lot of you put "//comment" for comments?
Isn't the proper way for comments to be /* comment */?
wouldn't // just screw your progam up?(I really don't use...
OH. I see now. Yeah, I definitely want to return the highest value, not the index. Thanks for the tip though, I have a function in my next assignment which DOES need the highest index.
I'm not quite sure what you mean, but are you forgetting that the initialazation of the for loop only happens once or something? I don't understand why I need another variable.
And where did...
I also just noticed I was using int for my double functions, and I was using double variables in ones that should be integers.
for instance darray[d] where d is a double. Where in the world will...
[code]int imax (int iarr[], int num)
{
int i, max;
for (max = -36667, i = 0; i < num; i++)
{
if (iarr[i] > max)
max = iarr[i];
}
return max;
Hmm, just a question, what are the real life applications of making memory proportional to the program's output, or is it just some gimmick your teacher is using to make the assignment harder?
Yes, I don't believe saying that homework is the problem. I believe not stating the problem you are particualrly having is the problem. it will make someone assume that you just want them to write it...
int isum (int iarr[], int num)
{
int i, sum;
for (i=0, sum=0; i < num; i++) total += iarr[i];
return sum;
}
int dsum (double darr[], double num,)
{
I knew all about what they meant, and about the 0 thing, and I also knew how to declare functions, but now I understand that about how about the box[i] thing. I see how I can increase the function.
...
I use the compiler jgrasp, and scanf presents problems for me too.
for example, my code will be
printf ("Enter the value for N: ");
scan f ("%lf", &N);
Instead of printing "Enter the...
Hi. I am goodn. i hope to contribute helpfully to your board later, but right now I am the one in need of help. In my c class we are starting to go over Arrays. I really have no grasp of them, other...