Question

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

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

#include<stdio.h>

int main(){
   char *passptr;
   char ch='Y';//variable pointed by passptr
   passptr=&ch;//assigning variable to pointer
   printf("%c",*passptr);//accessing the value of variable pointed by passptr
   return 1;
}

value of the variable pointed by pointer can be accessed using *ptr.pointer stores the address of the variable to which it points in our case variable ch.

Expected output:

Y

Add a comment
Know the answer?
Add Answer to:
Programming in C 5. (14 pts) Write a single statement to do each of the following:...
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
  • C language 5. (14 pts) Write a single statement to do each of the following: a....

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

  • Write a single C++ statements to accomplish each of the following tasks: In one statement, assign...

    Write a single C++ statements to accomplish each of the following tasks: In one statement, assign the sum of the current value of x and y to z and postincrement the value of x. Determine whether the value of the variable count is greater than 10. If it is, print “Count is greater than 10.”. Pre-decrement the variable of x by 1, then subtract it from the variable total. Multiply variable power by x and assign the result to power.  ...

  • I NEED HELP WITH C PROGRAMMING. Answer each of the following. Assume that unsigned integers are...

    I NEED HELP WITH C PROGRAMMING. Answer each of the following. Assume that unsigned integers are stored in 4 bytes and that the starting address of the array is at location 200 600 in memory. i)What address is referenced by vPtr + 5? What value is stored at that location? j) Assuming vPtr points to values[6] , what address is referenced by vPtr -= 4? What value is stored at that location? Also ..... For each of the following, write...

  • aList = [1, 'Mercy', 20, 'Cyber', 300]. a) Write a single line of Python statement to...

    aList = [1, 'Mercy', 20, 'Cyber', 300]. a) Write a single line of Python statement to print the value 20 from aList. b) Write a single line of Python statement to print the character b from aList. c) Write a single line of Python statement to print erc from aList. d) Write a Python segment that print a sequence number starting from 1 followed by ")" and an element for each element of the list. Use a for loop and...

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

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

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