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 would be the output of the following program

main()
{
int a[] = {1,2,3,4,5};
int *ptr = {a,a+1,a+2,a+3,a+4};
printf("%d %d %d %d",a,*ptr,**ptr,ptr);
}

}



what would be the output of the following program main() { int a[] = {1,2,3,4,5}; int *ptr =..

Answer / vadivelt

Output:

1.Base address of 'a'
2.Base address of 'a' (Since ptr holds address of the array 'a')
3.Value at the base address of 'a' ie., 1
4.Base address of array of pointers ie., address of 'ptr'

The above answer is valid provided the initialisation of *ptr
should be a array of pointers.

ie., initialisation should be int *ptr[]=
{a,a+1,a+2,a+3,a+4};

Otherwise it leads to compilation error

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

where do we use volatile keyword?

1 Answers  


If 4 digits number is input through the keyboard, Write a program to calculate sum of its 1st & 4th digit.

12 Answers   Google,


For what purpose null pointer used?

0 Answers  


What are the types of operators in c?

0 Answers  


Explain how can I convert a string to a number?

0 Answers  


Why do we need arrays in c?

0 Answers  


printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

0 Answers  


What is the use of getchar() function?

0 Answers  


write a program to sort the elements in a given array in c language

10 Answers   TCS,


What should malloc() do?

0 Answers  


Disadvantages of C language.

0 Answers   Impetus,


what is difference between strcmp & palindrome?

3 Answers  


Categories