1,663 views
1 votes
1 votes

what is the output of the following c code?

#include<stdio.h>
void main()  
{      
    int index;      
    for(index=1;index<=5;index++)      
    {          
        printf("%d",index);
        if(index==3)
            continue;
        }  
}

a)1245

b)12345

c)12245

d)12354

3 Answers

0 votes
0 votes
it keep on printing 1 till stack overflows since every time in for loop index will be compared and it will be less than 5 so infinite loop nothing to do with i it will be keep incremented at each iteration.

Related questions

1 votes
1 votes
2 answers
1
Umang Raman asked Oct 7, 2015
1,196 views
int main (){ int a=5,b=3; printf("%d", a+++++b); // 5 +'s }Please Explain.
2 votes
2 votes
5 answers
2
debanjan sarkar asked Sep 3, 2015
6,609 views
void myfunc(int X){ if(X 0) myfunc( X ); printf("%d", X); } int main(){ myfunc(5); return 0; }0,0,1,2,3,44,3,2,1,04,3,2,1,0,00,1,2,3,4
1 votes
1 votes
1 answer
3
Nishikant kumar asked Nov 16, 2015
965 views
void abc(int x, int y){ pf("%d%d", x, y); } void main(){ int a; a = 12; abc(++a, a++); pf("%d", a); }14,12,1413,12,1311,12,1214,14,14
0 votes
0 votes
1 answer
4
debanjan sarkar asked Aug 21, 2015
1,131 views
Find the output of the following c code- main() { char *ptr="gatebuddy"; *(ptr)++; ptr++; printf("%s\n",ptr); }