void main()
{
int a[]={1,2,3,4,5},i;
for(i=0;i<5;i++)
printf("%d",a++);
getch();
}
Answers were Sorted based on User's Feedback
Answer / jaya.vavilala
output is error.because we cannot inrease address of
array.if we increase address can be increased after go on
increasing after 5th position it cannot find where it is
present.so we cannot increase array directly through
pointer we can increase.
| Is This Answer Correct ? | 13 Yes | 1 No |
Answer / vikas thakur
The answer is error.
The reason is that we can't increment a constant(the
variable int a[] ). The expression int a[] is the address
where the system had placed your array and it will remain
to stay at that address until the program terminates. you
can't increment an address but you can increment a pointer.
.....the correct program would be....
void main()(
int a[]={1,2,3,4,5},i;
for(i=0;i<5;i++)
printf("%d",a[i]);
getch();
}
....in another way.....
void main()(
int a[]={1,2,3,4,5},i;
int *p;
p = a;
for(i=0;i<5;i++)
printf("%d",*(p++));
getch();
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / chhaya
Here , in program array is given of 5 element. But at d
time of printing output ,increase address not pointer
i.e.
a[i]={1,2,3,4,5}
then u wnat to print array
Printf("%d",i++);
getch();
this sentence is requird. because array is set of element
and element is pointed by "pointer". If u wnt to show
element then use pointer not address of array.....
| Is This Answer Correct ? | 0 Yes | 0 No |
Reverse the part of the number which is present from position i to j. Print the new number.[without using the array] eg: num=789876 i=2 j=5 778986
in one file global variable int i; is declared as static. In another file it is extern int i=100; Is this valid ?
there is two conditions , 1. while using for loop for printing 1 to 50 no's simulteneous 2. while using printf functios for printing 1 to 50 no's simulteneous with or without using variables who will take more time for compiling and execution? explain in details with reason?
What is a 'null pointer assignment' error?
How can I implement opaque (abstract) data types in C? What's the difference between these two declarations? struct x1 { ... }; typedef struct { ... } x2;
discuss the steps needed to get a program from source code to executable in a system?
In how much time you will write this c program? Prime nos from 1 to 1000
1 1 12 21 123 321 12344231 how i creat it with for loop??
simple program of graphics and thier outpu display with a want what is out put of graohics in c language
Explain how do you convert strings to numbers in c?
What are the different types of C instructions?
What is class and object in c?