Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SULIT (EKT 150) Question 3 (C3, C01, PO1) a) Trace the output of the following program segment: int *ptr, q; q = 50; ptr =

image text in transcribed

SULIT (EKT 150) Question 3 (C3, C01, PO1) a) Trace the output of the following program segment: int *ptr, q; q = 50; ptr = &q; printf("%d", *ptr); (2 Marks) b) Write the function definition for function swap, to swap two numbers. #include void swap (int *ni, int *n2); //function prototype int main() { int num1 = 5 num2 = 10; swap (&num1, &num2); //function call printf ("num1 = %d ", num1); printf("num2 = %d ", num2); return 0; //function definition for function "swap" (4 Marks) c) Write a function definition that accepts a string as an input and then prints the characters in the string in a reverse order. Example, the input string "UniMAP will be displayed as PAMinU. (Hint: You could use the strlen() function to find the string length.) (6 Marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

Students also viewed these Databases questions