main()
{
int x=5;
clrscr();
for(;x<= 0;x--)
{
printf("x=%d ", x--);
}
}
a. 5, 3, 1
b. 5, 2, 1,
c. 5, 3, 1, -1, 3
d. ā3, -1, 1, 3, 5
Answers were Sorted based on User's Feedback
Answer / purushotam111
Just change the operator in for >= instead of <=
then our answer is 5 , 3 , 1
| Is This Answer Correct ? | 16 Yes | 2 No |
main( ) { char *q; int j; for (j=0; j<3; j++) scanf(ā%sā ,(q+j)); for (j=0; j<3; j++) printf(ā%cā ,*(q+j)); for (j=0; j<3; j++) printf(ā%sā ,(q+j)); }
int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }
main() { extern int i; i=20; printf("%d",sizeof(i)); }
#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d----%d",*p,*q); }
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }
which function is used to clear the buffer stream on gcc? for example: I wrote following code on gcc #include<stdio.h> int main(void) { char ch; int a,b; printf("\nenter two numbers:\t"); scanf("%d%d",&a,&b); printf("enter number is %d and %d",a,b); printf("\nentercharacter:\t"); scanf("%c",&ch); printf("enter character is %c",ch); return 0; } in above progarm ch could not be scan. why?plz tell me solution.
What are segment and offset addresses?
#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }
main() { char *cptr,c; void *vptr,v; c=10; v=0; cptr=&c; vptr=&v; printf("%c%v",c,v); }
main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }
Is this code legal? int *ptr; ptr = (int *) 0x400;
What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }