Solutions to C programming questions

1 solution) gives compiler error because of post increment on an expression and it it valid only on variable


2 solution) 9 9 56



3 solution) ans1: x*=y+1;
ans2:x*=++y,y--;



4 solution) emptystring or nthing



5 solution) First call can take an integer as input whether or not you put any spaces/newlines/white space characters before it.
But the second call expects at least one ' ' [ space ] character and then some/none white space characters and then an integer.



6 solution) 16


7 solution) 1111


8 solution) prints the numbers in 2 rows each containing 10 elements with in between spaces


9 solution) it won't because of overflow in the statement *a=*a+*b;


10 solution) 4 8


11 solution) 987641

12 solution) 2 1 2

13 solution) unsigned/**/int/**/p;


14 solution) 3 3 5 5


15 solution) output1:2 3
output2:2 4


16 solution) 111


17 solution) 82


18 solution) segmentation fault


19 solution) 15


20 solution) (nil)


21 solution) It prints the lower case letters present in the input


22 solution) 3 1


23 solution) 12
concatinate(1,2)


24 solution) *1 -> replacing '<' with '+' in the declaration of the loop #include
int main(){
int n = 42;
for(int i = 0; i + n; i-- )
printf("-");
return 0;
}
* 2 -> replacing n with i in the declaration of the loop
#include
int main(){
int n = 42;
for(int i = 0; i <> adding a '-' before i in the comparison in for loop
#include
int main(){
int n = 42;
for(int i = 0; -i < href="http://placementsindia.blogspot.com/2007/10/c-programming-questions.html"> click here for questions

2 comments:

  1. This blog awesome and i learn a lot about programming from here.The best thing about this blog is that you doing from beginning to experts level.

    Love from

    ReplyDelete