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
code for find determinent of amatrix
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
Why c is called a middle level language?
Where can I get an ansi-compatible lint?
Is c is a high level language?
How a string is stored in c?
Why & is used in c?
Is c compiled or interpreted?
What is function prototype in c language?
Explain how can I manipulate strings of multibyte characters?
What do you understand by normalization of pointers?
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
How can a number be converted to a string?
Using which language Test cases are added in .ptu file of RTRT unit testing???
Write a c program to demonstrate character and string constants?