- Case Study Help
- Programming Assignment Help
- Programming Code Languages Quiz Questions and Answers
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
NEED ASSIGNMENT HELP?

CASESTUDYHELP PROMISE

Boost Your MBA Grade!

CDR for Engineers Career

Related Services :
- Linux Assignment Help
- What is Programming Language? and Types of Programming Languages
- Information Technology Assignment Help
Hire a Casestudyhelp Expert

Exclusive Offers
