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);
}

}

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how can type-insensitive macros be created?

961


Want to know how to write a C program that 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.

2000


A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream

1131


Is it valid to address one element beyond the end of an array?

1137


What are near, far and huge pointers?

1023


What is a structure member in c?

966


Can we compile a program without main() function?

1084


What are the application of void data type in c?

1150


How is a structure member accessed?

1077


Can a pointer be static?

1032


What are global variables?

1130


When is a null pointer used?

1075


What is void pointers in c?

968


What is the significance of scope resolution operator?

1370


what is bit rate & baud rate? plz give wave forms

1924