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...

In the below code, how do you modify the value 'a' and print
in the function. You'll be allowed to add code only inside
the called function.

main()
{
int a=5;
function(); // no parameters should be passed
}
function()
{
/* add code here to modify the value of and print here */
}

Answer Posted / aravind

#include<stdio.h>
void function(void );
int main()
{
int a=5;
function();
}
function()
{
int a=4;
printf("%d",a); /* a here is a local variable*/
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how should functions be apportioned among source files?

1095


What do you know about the use of bit field?

1042


program to find out date after adding 31 days to a date in the month of febraury also consider the leap year

3081


Explain two-dimensional array.

1056


Is printf a keyword?

1194


A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none

1238


What is the sizeof () operator?

1077


I need a sort of an approximate strcmp routine?

1024


What is the difference between local variable and global variable in c?

1224


What are the types of arrays in c?

1170


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

1894


What are the complete rules for header file searching?

1073


swap 2 numbers without using third variable?

1120


Explain what does it mean when a pointer is used in an if statement?

1057


What is a macro, and explain how do you use it?

1074