Point out the errors, if any, in the following C statements: (a) int = 314.562 * 150 ; (b) name = ‘Ajay’ ; (c) varchar = ‘3’ ; (d) 3.14 * r * r * h = vol_of_cyl ; (e) k = ( a * b ) ( c + ( 2.5a + b ) ( d + e ) ; (f) m_inst = rate of interest * amount in rs ;
I've only programmed in C++ but the answers should be the same (a) int = 314.562 * 150 ; int is a reserved word, you can't assign it a value. and if it does allow you to do that, then your assigning a double value to an int variable. (b) name = ‘Ajay’ ; if name is a string, you need " Ajay " (c) varchar = ‘3’ ; this should be okay. not sure (d) 3.14 * r * r * h = vol_of_cyl ; this is backwards. vol_of_cyl should be in front of the = (e) k = ( a * b ) ( c + ( 2.5a + b ) ( d + e ) ; your missing a parenthesis (f) m_inst = rate of interest * amount in rs ; rate of interest and amount in rs have spaces. can't have spaces in variable / function names
Thanks Its correct ! I knew the answer i just wanted to b sure so now i am sure !
kk, no problem :)
just an addition...e is wrong coz there are no operators between the parenthesis not because of missing par...
ok missing para...... too
doesn't it automatically multiply it? because of parenthesis i mean.
nope c compilers are not that smart :)
ah, i guess they added that in other languages then :)
(c) varchar is also a data type: http://publib.boulder.ibm.com/infocenter/idshelp/v111/topic/com.ibm.esqlc.doc/sii04981134.htm
So it is a reserved word.
And remember to close questions when done with them. =)
^ and ask new questions as new questions and not in the same thread.
Write a program in C language to implement three equation of motion for user define input.Can anyone help me in that
I also need help in a project ,i am suppose to make a little bit of a big program like a game or a calculator
Join our real-time social learning platform and learn together with your friends!