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 |
Write a main() program that calls this function at least 10 times. Try implementing this function in two different ways. First, use an external variable to store the count. Second, use a local variable. Which is more appropriate?
Explain what does a function declared as pascal do differently?
Is main() is used in the program,,see below example? void main() { int i; for(i=0;i<10;i++) main(); } Then what is the output of the program?
What is formal argument?
How can I manipulate individual bits?
how can we use static and extern?and where can we use this?
Write the following function in C. stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.
how can i make a program with this kind of output.. Enter a number: 5 0 01 012 0123 01234 012345 01234 0123 012 01 0
Can i use “int” data type to store the value 32768? Why?
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
0 Answers Sikkim Manipal University,
How do I copy files?
Is c procedural or object oriented?