Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the output of the following program?
main()
{
int c[]={2,8,3,4,4,6,7,5};
int j,*p=c,*q=c;
for(j=0;j<5;j++)
{
printf("%d",*c);
++q;
}
for(j=0;j<5;j++)
{
printf("%d",*p);
++p;
}
}

Answer Posted / ashwin kumar

output is 2222228344


in loop 1

as we know that array variable contain the base address of
the array

*c means we are trying to print the value of contained in
the base address which is not changed in the loop

note we can't change the base address of the array that is
we can't do 'c++'

as in loop for 5 times contain of the base address will be
printed as
22222



in loop 2

in assigned base address of the array to pointer p

here we are printing the contain of address stored in p and
increment the value of p ( that is pointing to the next
element of the array )

so we will get output for 2nd loop is

28344


overall answer is

2222228344

if any wroung in my aswer plz info me at

molugu.ashwin@gamil.com

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between struct and typedef struct in c?

1083


How can I find out how much free space is available on disk?

1013


Explain what math functions are available for integers? For floating point?

1062


Can we change the value of static variable in c?

971


Can you please explain the difference between strcpy() and memcpy() function?

1014


Explain how can I convert a string to a number?

1024


What is the difference between array and structure in c?

1085


How is actual parameter different from the formal parameter?

973


Why is C language being considered a middle level language?

1042


What is meant by gets in c?

1103


main use of recursive function a) processing speed high b) reduce program length/reduce repeated statements c) if you do not, use iterative methods like, for, while or do-while d) all the above

1043


Explain the properties of union. What is the size of a union variable

1129


What do the functions atoi(), itoa() and gcvt() do?

1136


What is a null string in c?

988


How can I delete a file?

1016