Question

5. (14 pts) Write a single statement to do each of the following: a. (7 pts) Assign character Y to the variable pointed to

C language
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) *passptr = 'Y';

Here passptr is a character pointer pointing to a character variable say a. Now when we write *passptr='Y', the value of variable 'a' becomes 'Y'.

2) Here the question is to print the value of passptr.

For that the statement is :

printf("%d", passptr) ;

Here passptr will holding address of a character variable. Therefore printing value of passptr is printing address of variable pointed by passptr.

But if the question is to print the value of variable pointed by passptr, then it is:

printf("%c", *passptr) ;

If you have any questions comment down.. Also please upvote thanks

Add a comment
Know the answer?
Add Answer to:
C language 5. (14 pts) Write a single statement to do each of the following: a....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Programming in C 5. (14 pts) Write a single statement to do each of the following:...

    Programming in C 5. (14 pts) Write a single statement to do each of the following: a. (7 pts) Assign character 'Y' to the variable pointed to by char pointer passptr, assuming passptr has already defined. b. (7 pts) Print the value of passptr above.

  • program in C program in C 5. (14 pts) Write a single statement to do each...

    program in C program in C 5. (14 pts) Write a single statement to do each of the following: a. (7 pts) Assign character 'Y' to the variable pointed to by char pointer passptr, assuming passptr has already defined. b. (7 pts) Print the value of passptr above. I Page 4 / 4 - Q +

  • please write the code in C++ AND BE VERY SURE OF IT SINCE IT IS AN...

    please write the code in C++ AND BE VERY SURE OF IT SINCE IT IS AN ASSIGNMENT WITH LOTS OF MARKS - DON'T COPY FROM THE INTERNET I- For each of the following, write a single statement that performs the specified task. Assume that long integer variables value1 and value2 have been declared and value1 has been initialized to 200000. a)- Declare the variable longPtr to be a pointer to an object of type long. b)- Assign the address of...

  • C language not C++ 1. Write the statements to do the following: (2 pts) a. Define...

    C language not C++ 1. Write the statements to do the following: (2 pts) a. Define a struct with member variables width, height, topleft x, topleft y all floats). Use a tag to call it Rectangle. b. Declare a variable struct type Rectangle 2. Consider the following variables: struct int x; float y; char zi var1; union nt x; float y; char[20] z;) var2 f float and int are stored using 4 bytes each, what is the size (in bytes)...

  • this is in C programming language 1. Write a printf or scanf statement for each of...

    this is in C programming language 1. Write a printf or scanf statement for each of the following: a) Print unsigned integer 1001 right justified in a 10-digit field with 5 digits. b) Read a hexadecimal value into variable hex. c) Print 300 with and without a sign. .d) Print 200 in hexadecimal form preceded by Ox. e) Read characters into array m until the letter z is encountered. f) Print 7.350 in a 7-digit field with preceding zeros. B)...

  • please answer all the questions. 2. (35 pts, 5 each) Consider the following array a. Write...

    please answer all the questions. 2. (35 pts, 5 each) Consider the following array a. Write single-line statements to do the following double a[8] {0.0, = 10.0, 20.0, 30.0, 40.0), *p , ,g: Set the pointer p to point to the first element of the array - I ?-K-U) Set pointer q to point to the element with value 20.0 in the array as afn] with the correct n value. Use p above to triple the value stored in a[1]...

  • the coding language is in c++ An array named testScores has already been declared. -size= 5...

    the coding language is in c++ An array named testScores has already been declared. -size= 5 -data type = float - the array has already been initialized these values: 77, 88.5, 90, 93, 71.5 -Write one statement to declare a pointer named: ptr - in the same statement, assign the address to the testScores array to the pointer -write one statement to output the memory address of the array element at testScores[0] -Write a for loop to output the values...

  • Write a single C statement to accomplish each of the following tasks: Assign the sum of...

    Write a single C statement to accomplish each of the following tasks: Assign the sum of x and y to z and decrement the value of y by 1 after the calculation. Multiply num by 3 using the *= operator. Increment variable x by 1, then subtract it from variable value. Add variable x to variable total, then increment x by 1.

  • Using Structures in C language programming

    Write code to accomplish each of the following:Define a structure called Dove containing int variable dovNo and char array dovArr with values that may be as long as 25 characters (including the terminating null character).Define dove to be a synonym for the type struct Dove.Use Dove to declare variable a to be of type struct Dove, array b[ 10 ] to be of type struct Dove and variable ptr to be of type pointer to struct Dove.Read a dovNo and a dovArr from the keyboard into the individual members of variable a.Assign the member values of variable a to element 3 of array b.Assign the address...

  • #1. What is the value (in hex) of%ol after each set of instructions Which of the following logic ...

    Please answer the following questions and explain what they are doing. Thanks! #1. What is the value (in hex) of%ol after each set of instructions Which of the following logic gate symbols represents set 0x89ABCDEF, %01 set 0x12345678, o2 xor %o1, %o2, %01 XNOR Value in %01 at this point is 0x -NOR NAND XOr b) set 0x89ABCDEF, 801 set 0x12345678, %02 and %01, %o2, %o1 Value in 9601 at this point is 0x set 0x89ABCDEF, o1 sra %01, 20,801...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT