- 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 Assignment Help from Subject Matter Experts 24/7
Obtain expert assistance with assignments and homework when you need it most. Receive well-researched, AI-free unique solutions to earn better grades.
NEED ASSIGNMENT HELP?
Boost Your MBA Grade!
CDR for Engineers Career
Browse Similar Services
- PHP Assignment Help | Expert Programmers for Your Success
- Linux Assignment Help
- What is Programming Language? and Types of Programming Languages
- Information Technology Assignment Help