Switch (i)
i=1;
case 1
i++;
case 2
++i;
break;
case 3
--i;
Output of i after executing the program

Answers were Sorted based on User's Feedback



Switch (i) i=1; case 1 i++; case 2 ++i; break; case ..

Answer / shruti

WHAT IS THE VALUE OF I BEFORE ENTERING THE SWITCH CASE???

if the values is something other than 1 , 2 , 3 there wont
be any effect, ASSUMING u have forgotton to give the curly
braces.


otherwise,
you will get an error, if the curly braces are not there
for the switch case.

Is This Answer Correct ?    7 Yes 0 No

Switch (i) i=1; case 1 i++; case 2 ++i; break; case ..

Answer / jack

the value of i that was initialized before the switch
statement remains unchanged as the switch statement does
not have flower braces.

Is This Answer Correct ?    5 Yes 0 No

Switch (i) i=1; case 1 i++; case 2 ++i; break; case ..

Answer / ramesh

i as it is

Is This Answer Correct ?    5 Yes 0 No

Switch (i) i=1; case 1 i++; case 2 ++i; break; case ..

Answer / vinay

the value of i if we forget the mistake u done

it is i=2;

Is This Answer Correct ?    1 Yes 3 No

Switch (i) i=1; case 1 i++; case 2 ++i; break; case ..

Answer / rukmanee

output: i=1

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More C Interview Questions

hi any body pls give me company name interview conduct "c" language only

0 Answers  


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

0 Answers   Wilco,


What is assert and when would I use it?

0 Answers  


why Language C is plateform dependent

3 Answers   Siemens, Wipro,


How does pointer work in c?

0 Answers  






list the no of files created when c source file is compiled

9 Answers   TCS,


Read N characters in to an array . Use functions to do all problems and pass the address of array to function. 1. Print only the alphabets . If in upper case print in lower case vice versa. 2. Enter alphanumeric characters and form 2 array alphaets and digits.Also print the count of each array. 3. Find the count of a certain character. 4. Print the positions where a certain character occured. 5. Print the characters between successive array elements. 6. Find the largest and smallest charcter. How many times it each one occured. 7. Enter a certain range. Print out the array elements which occured between these range. 8. Reverse a character array without using another array. 9. Reverse an array region. 10. Replace a the array elements with it next character . Use a after z. 11. Code the array element with certain character as first alphabet. 12. Duplicate all the vowels in a character array. What is the new count. 13. Delete the vowels in a character array. What is the new array count. 14. Print the count of all characters in the array. 15. Enter n alphabets and store a upto tht charcter in array.What is the array count? 16. Sort a character array. 17. Merge 2 character arrays largearray,smallarray. 18. Find the pair with largest number of characters in between. 19. Find the numerical value of a charcter array. 20. Store n numeral characters in an arrray. Insert another numeral character in a certain position. 21. Insert a character in a sorted array. 22. Merge 2 sorted arrays in sorted fashion. 23. Duplicate the least occuring character. 24. Write a menu driven program to circular right/left shift an array of n elements. 25. Is the character array palindrome? if not make it palindrome. 26. Concatenate the first n charaters to the end of the string. 27. Print all n group of chracters which are palindrome. 28. Concatneate the reverse of last n characters to the array.

0 Answers  


Write a C program in Fibonacci series.

0 Answers   iNautix,


what is compiler

6 Answers  


Explain what is wrong with this program statement? Void = 10;

0 Answers  


What is volatile

2 Answers  


5. What kind of sorting is this: SORT (k,n) 1.[Loop on I Index] repeat thru step2 for i=1,2,........n-1 2.[For each pass,get small value] min=i; repeat for j=i+1 to N do { if K[j]<k[min] min=j; } temp=K[i];K[i]=K[min];K[min]=temp; 3.[Sorted Values will be returned] A)Bubble Sort B)Quick Sort C)Selection Sort D)Merge Sort

2 Answers   Accenture,


Categories