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 k = 123;
char *ptr;
ptr = &k;
printf("%d",*ptr);
}

Answer Posted / vadivelt

Output would be 123.

Since, the character pointer can hold the values
0 - 255(if it is unsigned) or -128 to 127 (if it is signed), we
will get value of k as result.

But if the k value is k > 255 and the pointer is unsigned,
or if the k value is k > -129 and k < 128 and the pointer
is signed then only lower 1 byte of k would be the result.
Remaining data will be lost.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a program to find out prime number using sieve case?

2034


Do you know the difference between malloc() and calloc() function?

1003


we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above

1102


What is structure padding and packing in c?

1003


What is declaration and definition in c?

1014


Explain how can I manipulate strings of multibyte characters?

1156


Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

958


Can you write the algorithm for Queue?

2026


pierrot's divisor program using c or c++ code

2166


What is a method in c?

1060


What is the difference between typedef struct and struct?

1063


What are the types of data files?

1146


What are derived data types in c?

1007


What is variable in c example?

992


Do you have any idea about the use of "auto" keyword?

1049