# Newbie Question integers and variables

• 05-25-2006
MrMe
Newbie Question integers and variables
Hi all!

I'm a newbie and wonder why:

int a, b, c;
a = 5;
b = 12000;
c = a*b;
printf("%d", c);

does not yield 60000

• 05-25-2006
laserlight
Um, it looks okay to me.
• 05-25-2006
whiteflags
60000 is probably to big for an integer to hold on your system. Use a long int instead, and write
Code:

`printf("%ld", c);`
to specify a long digit.
• 05-25-2006
MrMe
Ah, that makes sense. I thought an integer could hold higher numbers... guess it does depend on the system and/or the compiler...

Thanks! :D
• 05-25-2006
prog-bman
BTW what complier/os are you using?
• 05-25-2006
MrMe
The thing is, I'm not, but I have this "study" question that asked this question and I couldn't figure out why.... it wasn't suppose to work...
• 05-25-2006
prog-bman
Very sneaky way to get people to do your work GJ ;)
• 05-25-2006
MrMe
yeah.... now I have a different problem I have no answer to...... maybe you could answer exactly what this function does with the string...

Code:

```void foo(char *string, int length) {   char temp;   if(length < 2)     return;   else {     temp = *string;     *string = string[length - 1];     string[length -1] = temp;     foo(string+1, length-2);   } }```
• 05-25-2006
Richie T
it recursively reverses the characters in the string. If this is homework, read the board policy.
• 05-25-2006
quzah
Quote:

Originally Posted by MrMe
yeah.... now I have a different problem I have no answer to...... maybe you could answer exactly what this function does with the string...

I've got a better idea. Make a test program, stick the function in it, and find out for yourself.

Quzah.