I would recommend code:blocks. It runs on windows and linux and you can debug your code in the ide.
Type: Posts; User: joemccarr
I would recommend code:blocks. It runs on windows and linux and you can debug your code in the ide.
i is declared twice also.
I will try not to look but I am not the most disciplined person in the world.
I am pretty sure that the way I was using malloc etc. is not the way
to use it (i.e. for each string) as there is...
@Salem, thanks for that explaination. That was not explained in the text book I'm going through. At least not yet.
I see now how it would overflow now because of the added null character. Is...
I am learning to use malloc & calloc.
I am using strlen with calloc to store the string in memory.
First thing is that I did not expect is that malloc is reserving 32 bytes for the string instead...
Yes, that way is better for using more descriptive variable names.
I have not seen this use before "xA23456789TJQK"[hand[i].value] but I like it. Just a substitution.
Thanks for your help. ...
I am getting this error when compiling- Operands of '=' have incompatible types 'div_t [5]' and 'div_t *
I have played around with different ways of getting rid of this error but to no avail. Any...
I don't see how you are going to get the line numbers in front of the lines any other way.
If your tutor has a sense of humor, you can try this ...
while((c=getchar())!=EOF)
if ( c...
Understood, thanks
Not sure if I follow, your saying to use '0' because it shows that I am intending to manipulate ASCII ?
-----------------------------------------------------------------
Well its not that simple of a problem if you are just starting out with C.
The parts to finish this are in the responses you got.
Because I meant add 48 to the int to get to the correct ascii number.
That's correct, I didn't want to give him the whole answer just something to get him going in the right direction
Ouch !
You could use something like this, which is what Salem was talking about.
For displaying line #s 1 - 9 ...
if ((linenum > 0) && (linenum < 10)){
putchar('0');
...
I'd call him again. It kinda looks like the number of local & global variables is not constant ; )
Here's a hint
Use this in your while loop to store the input characters.
mystring[i++]=c;
At the end of your program you want to print out this string but with the line numbers in front.
Thanks Salem, that makes sense.
Actually it was a warning, not an error.
So I ran the program and it was able to excute the line that was flagged in the warning.
I am using Pelles compiler, so I posted on their forum.
I get the above error. Compiler doesnt like the highlighted lines floor-0;
below. My question is why would this be unreachable ?
#include <stdio.h>
int main(int argc, char *argv[])
{
...
Pelles C has an IDE with Bult-in Debugger. I used to work as an engineer and we made custom motherboards specific to what we did with no operating system. We didnt even use a debugger. We used an...
That is an excellent site, thanks
Happy Monday all,
There is a ton of references on the C library and language on the web.
What I have been having a difficult time is finding one that has examples along with it. Sometimes I have...
How about this, just uses inter math.
If the division return zero then you know the number does not take up that place holder
6294/1000=6
6294-6*1000= 294 subtract last result...
Yes, what she said.