main()
{
int i = 1;
int num[] = {1,2,3,4};
num[i] = i++;
printf("%d", num[i]);
}
what will be the output?
}
Answer Posted / tk
Answer is :: 3
Explanation::
main()
{
int i = 1;
int num[] = {1,2,3,4};
num[i] = i++; // Here i = 1, so num[1] = 1; and num =
{1,1,3,4}
// After the execution of this statement the value of i
will be 2 (as i++)
printf("%d", num[i]); // num[2] = 3 so answer is 3
}
}
Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is a pointer in c plus plus?
Write a program in c to replace any vowel in a string with z?
What is self-referential structure in c programming?
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
What is the use of function in c?
Are negative numbers true in c?
What is extern keyword in c?
Is c procedural or object oriented?
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.
State two uses of pointers in C?
Explain what are the different data types in c?
Differentiate between functions getch() and getche().
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
Is it valid to address one element beyond the end of an array?
What are the three constants used in c?