main()
{
int i = 1;
int num[] = {1,2,3,4};
num[i] = i++;
printf("%d", num[i]);
}

what will be the output?
}

Answers were Sorted based on User's Feedback



main() { int i = 1; int num[] = {1,2,3,4}; num[i] = i++; printf("%d", num[i])..

Answer / mortal

num[i] is num[1] and its reassigned as i++ that is 1 thus it
will print 1.
but im not at all sure about this..

Is This Answer Correct ?    2 Yes 10 No

main() { int i = 1; int num[] = {1,2,3,4}; num[i] = i++; printf("%d", num[i])..

Answer / sathya

num[i]=i+1
num[1]=1+1=2, but num[1] is 1.so there is a error...

Is This Answer Correct ?    4 Yes 13 No

Post New Answer

More C Interview Questions

Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me

0 Answers  


What is main () in c language?

0 Answers  


char p="data"; printf(p);

2 Answers  


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

0 Answers  


What is the code in while loop that returns the output of given code?

0 Answers  






How to use c/c++ code in JAVA

10 Answers   CDAC, IBM, Satyam, Scope International,


Explain the use of keyword 'register' with respect to variables.

0 Answers  


f=(x>y)?x:y a) f points to max of x and y b) f points to min of x and y c)error

4 Answers   HCL,


write a C program to print the program itself ?!

16 Answers   TCS,


How to add two numbers without using semicolon at runtime

2 Answers  


Explain what is a const pointer?

0 Answers  


What is wrong in this statement? scanf(“%d”,whatnumber);

0 Answers  


Categories