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
program in C

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

#include <stdio.h>
int main()
{
   char *passptr="Y" ;//question a
   printf(passptr);//question b
}

or

#include <stdio.h>
int main()
{
   char *passptr ;
   passptr="Y";
   printf(passptr);
}

both are same


1 2 #include <stdio.h> int main() vouw char *passptr ; passptr=Y; printf(passptr); }

Input main.c:6:4: warning: format not a string literal and no format arguments [-Wformat-security ... Program finished with e

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

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

  • 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 complete program that: 1) declares two local integers x and y 2) defines a...

    Write a complete program that: 1) declares two local integers x and y 2) defines a global structure containing two pointers (xptr,yptr) and an integer (z) 3) Declares a variable (mst) by the type of previous structure 4) requests the values of x and y from the user using only one scanf statement 5) sets the first pointer in the struct to point to x 6) sets the second pointer in the struct to point to y 7) uses the...

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

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

  • Hello. I just need help with my c++ code. Write a program that: Creates an integer...

    Hello. I just need help with my c++ code. Write a program that: Creates an integer variable AND an integer pointer variable Ask the user to input an integer value Store the value in the integer variable Print the address of the variable. Make the pointer variable point at the integer value Print the value pointed to by the pointer Print the address of the pointer

  • Write in C. Simple Program (beginner) Assignment: Write a program Character Pointers and Functions. (like program...

    Write in C. Simple Program (beginner) Assignment: Write a program Character Pointers and Functions. (like program #5-5). Keyboard input to enter one character string. Using a single dimension array, populate the array with the character string, call a function using pointers to reverse order the character string, pass back to the main the output and total_count_of_characters. (maybe use a global variable for the total count). Print display the reversed char string and total_count. <END>

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

  • Pointer tasks: ( In C++ ) 1. Write a program to store the address of a...

    Pointer tasks: ( In C++ ) 1. Write a program to store the address of a character variable and a float variable. • Print the address of both variables. • Print the values of variable using dereference operator. • Add 2 in float value using pointer. • Print address of character variable using reference operator. 2. Write a program that takes 5 elements in an array and print them in reverse order using pointers. 3. Write to program that takes...

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