Free Plagiarism Check Report

Programming Code Languages Quiz Questions and Answers

1.  Debug and Run the following code. This code is about the handling of pointers.  Create the Output the same as the given sample. Call your instructor to confirm the results then copy the screenshot of your code and output in the blank space below. (5 marks)

 

#include<stdio.h>

int main() {

       int pc;// consider pc as a pointer

       int c;   // consider c normal integer variable

       c = 22;

       printf("\n Address of c:%c\n", *c);

       printf(" Value of c:%d", c);

       pc = &c;

       printf(" pc:%d\n", pc);

       printf(" pc:%d\n\n", *pc);

       c = 11;

       printf(" pc:%u\n", pc);

       printf(" pc:%d\n\n", *pc);

       *pc = 2;

       printf(" Address of c:%c\n", &c);

       printf(" Value of c:%d\n\n", c);

      {

2.   Modify the following code in C to be able to read your first and last name up to a maximum 30 characters. Use Character type of array, with getting char and for loop to read from input character by character then print out on the screen only First and Last Name by using Character type of array, with for loop. Call your instructor to confirm the results then copy the screenshot of your code and output in the blank space below. (5 marks)

Output:

David James

 

starter code:

 

#include<stdio.h>

void main()

{

       inti = 0;

       char name[20];

       printf("\nEnter the Name : ");

       while ((name[i] = getchar()) != '\n')

              i++;

       getch();

}

3.  What is the output of the following code please explain it. Call your instructor to confirm the results then copy the screenshot of your code and output in the blank space below. (5 marks) (5 marks)

#include<stdio.h>

void main()

{

       int a[3] = { 1, 2, 3 };

       int *p = a;

       printf("%p\t%p", p, a);

       }

#include<stdio.h>

void main()

{

       char *s = "ETEC128";

       char *p = s;

       printf("%c\t%c", p[0], s[4]);

       }

Get This Answer with 24/7 Subject-Matter Experts

Get help instantly with No1 Assignment Help and Earn better grades
with 24/7 homework help

Chat Now

Great

Academic Solution

35000

Orders
Delivered

4.9/5

5 Star
Rating

3000+

Phd
Expert

Amazing Features

Plagiarism Free
Best Price
100% Money Back
Top Quality
On Time Delivery
24 x 7 Support

NEED ASSIGNMENT HELP?

Assignment Help Offers On Christmas Celebration

CASESTUDYHELP PROMISE

case study help features

Boost Your MBA Grade!

MBA Assignment Help Australia

CDR for Engineers Career

cdr for australia

Related Services :

 

Hire a Casestudyhelp Expert

assignment expert writer

Exclusive Offers

Book my Assignment

On Time Delivery

100% Plagiarism free work

Free Referencing Done

Our Experts

Top