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


Please Help Members By Posting Answers For Below Questions

What is a pointer in c plus plus?

898


Write a program in c to replace any vowel in a string with z?

869


What is self-referential structure in c programming?

870


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1467


What is the use of function in c?

908


Are negative numbers true in c?

772


What is extern keyword in c?

863


Is c procedural or object oriented?

767


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.

1901


State two uses of pointers in C?

811


Explain what are the different data types in c?

934


Differentiate between functions getch() and getche().

799


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

888


Is it valid to address one element beyond the end of an array?

898


What are the three constants used in c?

727