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 origram swaoing valu without 3rd variable
#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }
What is the output for the program given below typedef enum errorType{warning, error, exception,}error; main() { error g1; g1=1; printf("%d",g1); }
main() { int a[10]; printf("%d",*a+1-*a+3); }
Give a one-line C expression to test whether a number is a power of 2.
write a c program to Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 5 users and display the details. In place of password display “****”. (Use Structures).
0 Answers CDAC, College School Exams Tests,
main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }
9 Answers CSC, GoDB Tech, IBM,
Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)
main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }
main() { printf("%d", out); } int out=100;
Find the largest number in a binary tree
#include<stdio.h> main() { int i=1,j=2; switch(i) { case 1: printf("GOOD"); break; case j: printf("BAD"); break; } }