main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);
}
Answer / susie
Answer :
mmmm
aaaa
nnnn
Explanation:
s[i], *(i+s), *(s+i), i[s] are all different
ways of expressing the same idea. Generally array name is
the base address for that array. Here s is the base address.
i is the index number/displacement from the base address.
So, indirecting it with * is same as s[i]. i[s] may be
surprising. But in the case of C it is same as s[i].
| Is This Answer Correct ? | 37 Yes | 7 No |
write a c program to print magic square of order n when n>3 and n is odd?
main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }
main(int argc, char *argv[]) { (main && argc) ? main(argc-1, NULL) : return 0; } a. Runtime error. b. Compile error. Illegal syntax c. Gets into Infinite loop d. None of the above
main() { float f=5,g=10; enum{i=10,j=20,k=50}; printf("%d\n",++k); printf("%f\n",f<<2); printf("%lf\n",f%g); printf("%lf\n",fmod(f,g)); }
Is this code legal? int *ptr; ptr = (int *) 0x400;
main() { char *p="GOOD"; char a[ ]="GOOD"; printf("\n sizeof(p) = %d, sizeof(*p) = %d, strlen(p) = %d", sizeof(p), sizeof(*p), strlen(p)); printf("\n sizeof(a) = %d, strlen(a) = %d", sizeof(a), strlen(a)); }
Code for 1>"ascii to string" 2>"string to ascii"
1 Answers Aricent, Global Logic,
main() { int i=-1; -i; printf("i = %d, -i = %d \n",i,-i); }
How we print the table of 3 using for loop in c programing?
main() { char not; not=!2; printf("%d",not); }
main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }
29 Answers IBM, TCS, UGC NET, Wipro,
main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }