Ask your own question, for FREE!
Computer Science 19 Online
OpenStudy (anonymous):

if char c2='a' , c3='A', c4; c4=c2-c3; printf("the difference between capital letters and small letters is:%d\n",(int)c4); ... what is the effect of putting int before c4 ??

OpenStudy (espex):

You might want to look up "casting" in your C book.

OpenStudy (anonymous):

it will print the ascci code not the letters itself

OpenStudy (anonymous):

right ?

OpenStudy (microbot):

it should

OpenStudy (anonymous):

should what ! , why don't any one here easily write the answer or just say i don't know !!

OpenStudy (espex):

OS is not here to provide you answers, OS is here to help you learn and garner the answer for yourself.

OpenStudy (microbot):

it should print the ascii code, but i am not sure...try to run the code. i agree with @eSpeX

OpenStudy (anonymous):

sir i have just started learning the c language self learning and the comp. in not working & it's just a little new thing in a very very long code , and i just want to check if it right or not , and of course if the compilar had been working i wouldn't have the pleasure of asking you :)

OpenStudy (microbot):

ok 1st of all relax :P i am not an expert also..actually my skills go back to 7-8 years ago...plus do not have the compiler...trying to write as java and run it :) give some time :) ps not a sir :P

OpenStudy (anonymous):

haha my skills go for a week ago :)

OpenStudy (microbot):

try rerunning but initialize c4 as int ,not char. tell me if it helps

OpenStudy (microbot):

char c2='a',c3='A'; int c4; //c4= 'a'-'A'; c4= (int)c2 -(int)c3; System.out.println(c4); something like this (this is java code)

OpenStudy (anonymous):

another question please , would you please tell me the logical order of the opertators . is that order right () */% +- <=>= == != && || += -= /= *= ?

OpenStudy (espex):

Before you spend a great deal of time on this, what are you trying to accomplish?

OpenStudy (anonymous):

the value for 8/10*9%10 =10 ?

OpenStudy (microbot):

http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B for the operators

OpenStudy (anonymous):

i try to find the diff between visual basic language and c alnguage

OpenStudy (anonymous):

sir , micro , you made my day

OpenStudy (espex):

There are a great many differences between C and basic. Are you trying to accomplish a specific task with the OP code?

OpenStudy (anonymous):

but i am asking for the priority

OpenStudy (anonymous):

no just learnig what i need to learn

OpenStudy (espex):

Your precedence is http://www.isthe.com/chongo/tech/comp/c/c-precedence.html

OpenStudy (microbot):

any parenthesis to know the order or like u wrote it?

OpenStudy (espex):

Well trying to do mathematical operations on chars is not a very effective way to learn. I would suggest you start with a goal and work toward that end.

OpenStudy (anonymous):

snx sir

OpenStudy (anonymous):

no just i wrote it , is the order right ?

OpenStudy (microbot):

the value for 8/10*9%10 =0

OpenStudy (espex):

What you wrote will first divide 8 by 10, then multiply it by 9, then modulus the result with 10, which should not give you a remainder of 10.

OpenStudy (microbot):

the link for precedence @eSpeX gave you is great and easy to read. try recalculating the exsample you gave us so you can see why it is 0 and not 10.

OpenStudy (anonymous):

sry i was suppose to write 0 :D

OpenStudy (anonymous):

it will be 10*9=90 then 8/90 for int value zero then reminder of 0 %10 is zerp :D

OpenStudy (microbot):

yes :D

OpenStudy (anonymous):

while i am writing a code is there any diff between ++b and b++

OpenStudy (microbot):

yes the precedence in which they increment. sec ill find a good link for you

OpenStudy (anonymous):

look at this part of code

OpenStudy (anonymous):

int main() {int i=3; int j=9; int k=2; int m,n,o; m= ++i %k+j; printf("i=%d\nj=%d\n k=%d m=%d\n",i,j,k,m); n=j%i+m-- ; printf("i=%d\nj=%d\nk=%d\nn=%d\n",i,j,k,n); k+=8; printf("i=%d\nj=%d\nk=%d\n",i,j,k ); o=n/k*m%k; printf("i=%d\nj=%d\nk=%d\no=%d",i,j,k,o); getch () ; return 0; }

OpenStudy (anonymous):

it asks me in a problem to do such so , but i it keep saying that i=4 while i give it 3 to him , is that a generousness from c langiage :D

OpenStudy (microbot):

++i well it is being incremented so yes it should be 4.

OpenStudy (anonymous):

ahm , so when i write m=++i it= m=i+1 ?

OpenStudy (microbot):

yes

OpenStudy (anonymous):

ahh and if i write i=9 , and m=i-- it gives me i=8 but m = 9

OpenStudy (microbot):

yes that is because i-- will decrement the value of i, but return the pre-decremented value.

OpenStudy (microbot):

check the link i previously sent you

OpenStudy (anonymous):

i got it

OpenStudy (anonymous):

you made my day thank you , a 8 hours of studying ending by a person like you . is just great :)

OpenStudy (microbot):

heh very kind of you saying this :) good luck with your studies :) i am studying myself (java)

OpenStudy (anonymous):

my college mate has just ending study it , if you want anything he would like to help you ofc :)

OpenStudy (microbot):

thank you . very nice of him :)

OpenStudy (rsmith6559):

You may want to take a look at http://www.softintegration.com . They have a good C/C++ interpreter which would be perfect for this type of experiment.

OpenStudy (anonymous):

snx alot @rsmith6559

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!