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

A woman had somany gloves and hats 22 red,34 blue, 45 white...there was power cut and she took a glove and how many gloves shud she take so that she gets a pair of glove fr each color??

3 Answers   TCS,


Write a function to find the area of a triangle whose length of three sides is given

2 Answers  


What will be printed as the result of the operation below: #include<..> int x; int modifyvalue() { return(x+=10); } int changevalue(int x) { return(x+=1); } void main() { int x=10; x++; changevalue(x); x++; modifyvalue(); printf("First output:%d\n",x); x++; changevalue(x); printf("Second output:%d\n",x); modifyvalue(); printf("Third output:%d\n",x); }

2 Answers  


What is struct node in c?

0 Answers  


Create a registration form application by taking the details like username, address, phone number, email 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 3 users and display the details. While taking input password must appear as “****”.

0 Answers  


what is meant by flushll() in c programming?

1 Answers  


what is the advantage of using SEMAPHORES to ORDINARY VARIABLES???

2 Answers   NSN,


What is wrong with this program statement?

0 Answers  


how to generate the length of a string without using len funtion?

4 Answers  


Write a program to remove the C comments(/* */) and C++ comments(//) from a file. The file should be declared in command line.

4 Answers   Persistent, Subex,


What are 3 types of structures?

0 Answers  


write a c/c++ programthat connects to a MYSQL server and checks if the INNoDB plug in is installed on it.If so your program should print the total number of disk writes by MYSQL.

0 Answers   BirlaSoft,


Categories