# Thread: Newbie Question integers and variables

1. ## 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

2. Um, it looks okay to me.

3. 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.

4. Ah, that makes sense. I thought an integer could hold higher numbers... guess it does depend on the system and/or the compiler...

Thanks!

5. BTW what complier/os are you using?

6. 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...

7. Very sneaky way to get people to do your work GJ

8. 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);
}
}```

9. it recursively reverses the characters in the string. If this is homework, read the board policy.

10. 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.

Popular pages Recent additions