what will be the output of this program?
void main()
{
int a[]={5,10,15};
int i=0,num;
num=a[++i] + ++i +(++i);
printf("%d",num);
}
Answers were Sorted based on User's Feedback
Answer / viswanath
Ans: 15.
Exp: a[++i] means i = 1; so 10 + 2 +3
Is This Answer Correct ? | 7 Yes | 1 No |
Answer / nandkishor
Ans: 19.
Explanation: First expression (++i) execute. Hence i=1;
Than a[++i]=a[2]=15.
And than ++i=3.
Hence evaluation will be 15+3+1=19.
Note that expression closed in braces have high precedence.
Is This Answer Correct ? | 0 Yes | 0 No |
write a c program to Create employee record by taking details like name, employee id, address and phone number. While taking the phone number, take either landline or mobile number. Ensure that the phone numbers of the employee are unique. Also display all the details
Write a procedure to implement highlight as a blinking operation
main() { char *p = “ayqm”; char c; c = ++*p++; printf(“%c”,c); }
#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }
Cau u say the output....?
WAP to display 1,2,3,4,5........N
Write a Program that Inputs 10 Numbers in an Array and Show the Maximum Number
#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }
char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)
#define SQR(x) x * x main() { printf("%d", 225/SQR(15)); } a. 1 b. 225 c. 15 d. none of the above
main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }
#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }