[go: up one dir, main page]

0% found this document useful (0 votes)
206 views24 pages

Bca Jan 2024 Paper Solution C Lan

Husisjns

Uploaded by

hcgydtdf64
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
206 views24 pages

Bca Jan 2024 Paper Solution C Lan

Husisjns

Uploaded by

hcgydtdf64
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Que.

1:

---

Que.1 Attempt the following (any two)

(1) Explain the features of C language with its limitations

Features of C Language:

1. Simple and Efficient: C is a relatively simple language with a small set of keywords, making it
easy to learn. It is highly efficient, allowing low-level memory manipulation.

2. Structured Language: C follows the structured programming paradigm, meaning programs are
divided into functions to improve readability and maintainability.

3. Portability: C programs can run on various platforms with minimal modification, making it
portable. This is achieved through the use of the C Standard Library.

4. Low-Level Access: C allows direct manipulation of hardware resources through pointers,


making it ideal for system programming and embedded systems.

5. Rich Library Support: The C language provides a rich set of built-in functions, including math,
string, and file handling functions, making it versatile.

6. Memory Management: C provides dynamic memory allocation and deallocation via malloc(),
calloc(), free(), and realloc(), giving programmers fine control over memory.

7. Compilation Efficiency: C programs are compiled into machine code, making them execute
very quickly.

Limitations of C Language:

1. Lack of Object-Oriented Features: C does not support object-oriented features like classes,
inheritance, and polymorphism, which are available in languages like C++ and Java.

2. Memory Management Complexity: While C gives control over memory allocation, improper
memory management can lead to memory leaks, fragmentation, and pointer errors.

3. No Built-in Support for GUI: C does not have built-in support for graphical user interfaces
(GUIs), requiring third-party libraries or frameworks to create GUI applications.

4. Complex Syntax for Large Programs: As programs grow larger, the C language's syntax can
become difficult to manage and debug, especially without a clear modular structure.

5. No Exception Handling: Unlike languages like C++ or Java, C does not support built-in
exception handling, making error detection and handling more challenging.

---
(2) Differentiate between traditional C and modern C

Traditional C:

1. Historical Context: Traditional C refers to the original version of the language developed by
Dennis Ritchie in the 1970s and early 1980s.

2. Limited Functionality: Earlier versions of C lacked many advanced features present in modern
C, such as the const keyword and the standard library functions that we use today.

3. Memory Management: C in its early versions had basic memory management facilities and
lacked certain dynamic memory management functions like calloc (which came later).

4. Portability: Early versions of C were more hardware-dependent, making it harder to port C


programs across different systems.

5. No Standardization: Before the ANSI C standard (1989), C lacked a formal specification.


Different compilers had different implementations of the language.

Modern C (ANSI C, C99, C11, etc.):

1. Standardization: Modern C has been standardized (ANSI C in 1989 and later C99 and C11),
which defines the language syntax, semantics, and standard libraries. This makes modern C
more portable across different compilers.

2. Improved Syntax: New features like the restrict keyword, inline functions, and variable-length
arrays (C99) improve readability and functionality.

3. Support for Better Memory Management: New memory management functions like calloc and
better debugging techniques are supported.

4. Enhanced Libraries: Modern C includes extensive standard libraries for handling strings, math
operations, file I/O, etc.

5. Type Safety: New features like const and stricter type checking improve the type safety of
programs.

---

(3) Answer the following:

(A) Explain any one logical operator with example

Logical AND Operator (&&):

The logical AND operator (&&) is used to combine two conditional expressions. If both
conditions evaluate to true, the result is true; otherwise, it evaluates to false.

Example:
#include <stdio.h>

int main() {
int a = 5, b = 10;
if (a > 0 && b > 5) {
printf("Both conditions are true.\n");
} else {
printf("At least one condition is false.\n");
}
return 0;
}

In this example, since both a > 0 and b > 5 are true, the output will be "Both conditions are true."

(B) Explain the concept of variable with example

A variable is a storage location in memory that is associated with a name and can hold a value.
The type of the variable defines the size and type of data it can store (such as int, char, float,
etc.).

Example:

#include <stdio.h>

int main() {
int num = 10; // 'num' is a variable of type int
float pi = 3.14; // 'pi' is a variable of type float
char letter = 'A'; // 'letter' is a variable of type char

printf("Integer: %d\n", num);


printf("Float: %.2f\n", pi);
printf("Character: %c\n", letter);

return 0;
}

Here, num, pi, and letter are variables that store different types of data (integer, floating-point
number, and character).

---

(4) Answer the following:

(A) Differentiate between type casting and type conversion

1. Type Casting:

Definition: Type casting is the explicit conversion of one data type to another using casting
operators (e.g., (int), (float)).

Example: int x = (int)3.14; converts the float 3.14 to integer 3.


Purpose: It is done by the programmer to ensure that data types match when performing
operations.

2. Type Conversion:

Definition: Type conversion is an implicit conversion of one data type to another by the compiler,
typically when required in expressions. For example, converting an integer to a float when
performing arithmetic.

Example: float x = 3; automatically converts 3 (int) to 3.0 (float).

Purpose: It happens automatically based on the operator or function being used.

(B) Explain: Flow charts

A flowchart is a graphical representation of the flow of control in a program or process. It uses


different symbols to represent operations, decisions, and the flow of control. It is an important
tool for planning and designing algorithms.

Start/End: Represented by an oval shape.

Process: Represented by a rectangle, showing a step or operation.

Decision: Represented by a diamond shape, used to show conditional branching.

Arrow: Represents the flow of control from one step to another.

Example of a flowchart for finding the maximum of two numbers:

[Start]
|
[Input A, B]
|
[Is A > B?] ---- No ----> [Output B]
|
Yes
|
[Output A]
|
[End]

The flowchart above checks if A is greater than B. If true, it outputs A; otherwise, it outputs B.

---

Que.2:

---
Que.2 Attempt the following (any two)

(1) Explain giving example: Looping Logic

Looping in C refers to the process of repeatedly executing a block of code as long as a specified
condition is true. There are three main types of loops in C: for, while, and do-while.

Example:

#include <stdio.h>

int main() {
int i;

// For loop to print numbers from 1 to 5


for (i = 1; i <= 5; i++) {
printf("%d ", i);
}

return 0;
}

Explanation:

The for loop starts by initializing i = 1.

The condition i <= 5 is checked; if true, the code inside the loop is executed.

After each iteration, i is incremented by 1 (i++).

The loop continues until i becomes greater than 5.

The output of this program is:

12345

---

(2) List various decision structures. Explain any one with example

Decision Structures in C:

1. If Statement: Executes a block of code only if a specified condition is true.

2. If-Else Statement: Executes one block of code if the condition is true, and another if the
condition is false.

3. Nested If Statement: An if statement inside another if statement.

4. Switch Statement: Executes one out of several possible blocks of code based on the value of
an expression.
Explanation of if-else Statement with Example:

#include <stdio.h>

int main() {
int num = 10;

if (num > 0) {
printf("Positive number\n");
} else {
printf("Non-positive number\n");
}

return 0;
}

Explanation:

The if-else structure checks if the condition num > 0 is true.

If it is true, the first block (printing "Positive number") is executed.

If it is false, the second block (printing "Non-positive number") is executed.

The output of this program is:

Positive number

---

(3) Answer the following:

(A) Explain while loop with example

A while loop in C repeatedly executes a block of code as long as the specified condition
evaluates to true.

Example:

#include <stdio.h>

int main() {
int i = 1;

// While loop to print numbers from 1 to 5


while (i <= 5) {
printf("%d ", i);
i++; // Increment i after each iteration
}

return 0;
}
Explanation:

The while loop checks if i <= 5 is true before each iteration.

If true, the body of the loop executes, printing the value of i.

After each iteration, i is incremented by 1.

The loop continues until i becomes greater than 5.

The output of this program is:

12345

---

(B) Explain ternary operator with example

The ternary operator is a shorthand for an if-else statement. It has the following syntax:

condition ? expression1 : expression2;

If the condition is true, expression1 is executed.

If the condition is false, expression2 is executed.

Example:

#include <stdio.h>

int main() {
int num = 10;

// Using ternary operator to check if the number is positive or not


printf("%s\n", (num > 0) ? "Positive" : "Non-positive");

return 0;
}

Explanation:

The ternary operator checks if num > 0. If true, it prints "Positive", otherwise, it prints "Non-
positive".

The result of the ternary operation is directly printed using printf().

The output of this program is:

Positive

---

(4) Explain giving example: Use of break and continue statements


Break Statement:

The break statement is used to terminate a loop (or switch statement) prematurely when a
specific condition is met.

Continue Statement:

The continue statement skips the current iteration of the loop and moves to the next iteration.

Example:

#include <stdio.h>

int main() {
int i;

// Using break and continue in a loop


for (i = 1; i <= 10; i++) {
if (i == 5) {
break; // Break the loop when i equals 5
}
if (i == 3) {
continue; // Skip the iteration when i equals 3
}
printf("%d ", i);
}

return 0;
}

Explanation:

The for loop runs from 1 to 10.

When i == 3, the continue statement skips the current iteration and proceeds to the next iteration.

When i == 5, the break statement terminates the loop completely.

The output of this program is:

124

3 is skipped because of the continue.

The loop terminates before printing 5 because of the break.

---

Que.3:

---
Que.3 Attempt the following (any two)

(1) Differentiate between call by value and call by reference

Call by Value:

In Call by Value, a copy of the actual argument is passed to the function.

The function works on this copy, and any modifications made to the parameter inside the
function do not affect the original argument.

Example: Used when you want to preserve the original data.

Example of Call by Value:

#include <stdio.h>

void modify(int x) {
x = 10; // The original value won't change
}

int main() {
int num = 5;
modify(num); // Pass a copy of num
printf("Value of num: %d\n", num); // num remains 5
return 0;
}

Output:

Value of num: 5

Call by Reference:

In Call by Reference, the address of the actual argument is passed to the function.

The function directly modifies the original variable using this address, so any changes inside the
function affect the original argument.

Example: Used when you want to modify the actual data.

Example of Call by Reference:

#include <stdio.h>

void modify(int *x) {


*x = 10; // Modifies the original value
}

int main() {
int num = 5;
modify(&num); // Pass the address of num
printf("Value of num: %d\n", num); // num is now 10
return 0;
}

Output:

Value of num: 10

---

(2) What is a library function in C? Explain its usefulness in C programming

Library Function in C:

A library function is a pre-defined function that is available in C's standard library (stdio.h, math.h,
string.h, etc.).

These functions are ready to use and save time because they are already written, tested, and
optimized for various operations.

Usefulness of Library Functions:

1. Predefined and Reliable: Library functions are tested and proven to be error-free, reducing the
chances of bugs in programs.

2. Code Efficiency: Library functions help programmers avoid "reinventing the wheel" by providing
functions for common tasks like string manipulation, mathematical calculations, and I/O
operations.

3. Time-Saving: Programmers don't need to write code from scratch for frequently used tasks.

4. Better Maintenance: Because these functions are well-documented and widely used, they are
easier to maintain and optimize.

Example:

#include <stdio.h>
#include <math.h>

int main() {
double result = sqrt(25); // Calling the sqrt() library function
printf("Square root of 25 is %.2f\n", result);
return 0;
}

Output:

Square root of 25 is 5.00

The sqrt() function from math.h is used here to calculate the square root of 25.
---

(3) List and explain various types of UDF (User Defined Functions)

A User Defined Function (UDF) is a function that is defined by the user in a C program to perform
a specific task. Using UDFs improves modularity and reusability of code.

Here are the types of User-Defined Functions (UDFs):

1. Function with No Arguments and No Return Value:

This function does not take any arguments and does not return any value. It is often used for
actions like printing messages.

Syntax:

void function_name(void);

Example:

#include <stdio.h>

void printMessage() {
printf("Hello from the function!\n");
}

int main() {
printMessage(); // Function call
return 0;
}

2. Function with Arguments and No Return Value:

This function takes arguments but does not return any value. It is commonly used for functions
that perform an action using the provided values.

Syntax:

void function_name(type arg1, type arg2, ...);

Example:

#include <stdio.h>

void addNumbers(int a, int b) {


printf("Sum: %d\n", a + b);
}

int main() {
addNumbers(10, 20); // Function call with arguments
return 0;
}
3. Function with No Arguments but with Return Value:

This function does not take any arguments, but it returns a value to the caller. It is useful when
you need to calculate or fetch some value.

Syntax:

return_type function_name(void);

Example:

#include <stdio.h>

int getFive() {
return 5;
}

int main() {
int value = getFive(); // Storing the returned value
printf("Returned value: %d\n", value);
return 0;
}

4. Function with Arguments and Return Value:

This is the most common type of function. It takes arguments, performs an operation, and
returns a value to the caller.

Syntax:

return_type function_name(type arg1, type arg2, ...);

Example:

#include <stdio.h>

int multiply(int a, int b) {


return a * b;
}

int main() {
int result = multiply(10, 5); // Passing arguments and receiving a return value
printf("Product: %d\n", result);
return 0;
}

---

(4) Answer the following:


(A) List various date and time functions. Explain any one

Some of the commonly used date and time functions from time.h in C are:

1. time(): Returns the current time in seconds since January 1, 1970 (the Unix epoch).

2. localtime(): Converts the time_t value to a local time structure (struct tm).

3. gmtime(): Converts the time_t value to Coordinated Universal Time (UTC).

4. strftime(): Formats the time and date according to the given format.

5. mktime(): Converts a struct tm time structure to time_t format.

6. clock(): Returns the number of clock ticks elapsed since the program started (useful for
performance measurement).

7. difftime(): Returns the difference in seconds between two time points.

Explanation of time() function:

The time() function is used to get the current system time, which is returned as the number of
seconds since January 1, 1970 (epoch time).

Example:

#include <stdio.h>
#include <time.h>

int main() {
time_t currentTime;
currentTime = time(NULL); // Get the current time in seconds since the epoch

if (currentTime == ((time_t)-1)) {
printf("Unable to get the current time.\n");
return 1;
}

printf("Current time: %ld\n", currentTime); // Prints the time as seconds


return 0;
}

Output:

Current time: 1706749347

The time() function returns the current time in seconds, which can be used for various time-
related calculations or for timestamping events.

---
(B) List various string library functions. Explain any one

Here are some of the commonly used string functions in C:

1. strlen(): Returns the length of a string (not counting the null-terminator).

2. strcpy(): Copies one string into another.

3. strncpy(): Copies a specified number of characters from one string to another.

4. strcmp(): Compares two strings lexicographically.

5. strncmp(): Compares a specified number of characters from two strings.

6. strcat(): Concatenates (appends) one string to the end of another.

7. strncat(): Concatenates a specified number of characters from one string to another.

8. strchr(): Finds the first occurrence of a character in a string.

9. strstr(): Finds the first occurrence of a substring within another string.

10. strtok(): Breaks a string into tokens based on delimiters.

Explanation of strlen() function:

The strlen() function is used to find the length of a string. It returns the number of characters in
the string, excluding the null-terminating character ('\0').

Syntax:

size_t strlen(const char *str);

str is the pointer to the string whose length we want to find.

Example:

Certainly! Here's the continuation of the explanation for strlen() function:

Example:

#include <stdio.h>
#include <string.h>

int main() {
char str[] = "Hello, World!";
size_t length = strlen(str); // Calling strlen() to get the length of the string
printf("The length of the string is: %zu\n", length); // Output the length
return 0;
}

Output:
The length of the string is: 13

The strlen() function counts the number of characters in the string str excluding the null-
terminating character ('\0'), which gives the output 13 for the string "Hello, World!".

---

Que.4:

---

Que.4 Attempt the following (any two)

(B) List various string library functions. Explain any one

Some of the commonly used string functions in C (from string.h) include:

1. strlen(): Returns the length of a string.

2. strcpy(): Copies one string to another.

3. strncpy(): Copies a specified number of characters from one string to another.

4. strcmp(): Compares two strings.

5. strncmp(): Compares a specified number of characters between two strings.

6. strcat(): Concatenates (appends) one string to another.

7. strncat(): Concatenates a specified number of characters from one string to another.

8. strchr(): Searches for the first occurrence of a character in a string.

9. strstr(): Searches for the first occurrence of a substring in a string.

10. strtok(): Breaks a string into tokens based on delimiters.

Explanation of strcpy() function:

The strcpy() function is used to copy one string into another.

Syntax: char *strcpy(char *destination, const char *source);

destination: The pointer where the copied string will be stored.

source: The string to be copied.

Example:

#include <stdio.h>
#include <string.h>
int main() {
char source[] = "Hello, World!";
char destination[50];

strcpy(destination, source); // Copying source string to destination

printf("Source string: %s\n", source);


printf("Destination string: %s\n", destination);

return 0;
}

Output:

Source string: Hello, World!


Destination string: Hello, World!

---

(1) Explain giving example: two-dimensional array

A two-dimensional array is essentially an array of arrays. It is used to store data in a table-like


structure (rows and columns).

The general syntax for declaring a 2D array is:

data_type array_name[row_size][column_size];

Example:

#include <stdio.h>

int main() {
int arr[3][2] = {
{1, 2},
{3, 4},
{5, 6}
};

// Accessing elements of a 2D array


printf("Element at position [0][1]: %d\n", arr[0][1]); // Output: 2
printf("Element at position [2][0]: %d\n", arr[2][0]); // Output: 5

// Printing all elements of the 2D array


printf("All elements in the 2D array:\n");
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
printf("%d ", arr[i][j]);
}
printf("\n");
}
return 0;
}

Output:

Element at position [0][1]: 2


Element at position [2][0]: 5
All elements in the 2D array:
12
34
56

The 2D array arr has 3 rows and 2 columns, and you can access individual elements using two
indices: arr[row][column].

---

(2) Explain the concept of union with example

A union in C is a data structure that allows storing different data types in the same memory
location. Unlike a structure, a union can only hold one member value at a time, but the size of the
union is the size of its largest member.

Syntax:

union union_name {
data_type1 member1;
data_type2 member2;
...
};

Example:

#include <stdio.h>

union Data {
int i;
float f;
char str[20];
};

int main() {
union Data data;

// Storing an integer
data.i = 10;
printf("Data as integer: %d\n", data.i);

// Storing a float (This will overwrite the integer)


data.f = 220.5;
printf("Data as float: %.2f\n", data.f);

// Storing a string (This will overwrite the float)


strcpy(data.str, "Hello, Union!");
printf("Data as string: %s\n", data.str);

return 0;
}

Output:

Data as integer: 10
Data as float: 220.50
Data as string: Hello, Union!

In the example, the union named Data has three members: i, f, and str. When one member is
assigned a value, it overwrites any previously stored data in the union.

---

(3) Explain with syntax and example: nested structures

A nested structure is a structure in which one structure is a member of another structure. This
allows for more complex data representation.

Syntax:

struct outer {
data_type member1;
struct inner {
data_type member2;
} nested_member;
};

Example:

#include <stdio.h>

struct Address {
char street[50];
char city[50];
};

struct Employee {
int id;
char name[50];
struct Address addr; // Nested structure
};

int main() {
struct Employee emp = {1, "John Doe", {"Baker Street", "London"}};
printf("Employee ID: %d\n", emp.id);
printf("Employee Name: %s\n", emp.name);
printf("Employee Street: %s\n", emp.addr.street);
printf("Employee City: %s\n", emp.addr.city);

return 0;
}

Output:

Employee ID: 1
Employee Name: John Doe
Employee Street: Baker Street
Employee City: London

In this example, the Employee structure contains a nested structure Address to store the street
and city information.

---

(4) Answer the following:

(A) Explain: String array

A string array is an array of strings, where each element of the array is a string (array of
characters).

A string is a sequence of characters, terminated by a null character ('\0').

Syntax:

char array_name[number_of_strings][max_string_length];

Example:

#include <stdio.h>

int main() {
char names[3][20] = {"Alice", "Bob", "Charlie"};

// Accessing elements of the string array


for (int i = 0; i < 3; i++) {
printf("Name[%d]: %s\n", i, names[i]);
}

return 0;
}

Output:
Name[0]: Alice
Name[1]: Bob
Name[2]: Charlie

The names array contains 3 strings, each with a maximum length of 20 characters.

---

(B) Explain with example: array within structure

An array within a structure is a structure that contains an array as one of its members. This
allows you to group related data together, including arrays, under a single structure.

Example:

#include <stdio.h>

struct Student {
int rollNo;
char name[50];
int marks[5]; // Array within structure
};

int main() {
struct Student s1 = {101, "John", {85, 90, 88, 92, 95}};

printf("Roll Number: %d\n", s1.rollNo);


printf("Name: %s\n", s1.name);
printf("Marks in subjects: ");
for (int i = 0; i < 5; i++) {
printf("%d ", s1.marks[i]);
}

return 0;
}

Output:

Roll Number: 101


Name: John
Marks in subjects: 85 90 88 92 95

The structure Student contains an array marks[] that stores the marks of the student in 5
subjects.

---

Que.5:

---
printf("Read from file: %s\n", line);
fclose(file);

return 0;
}

Output:

Read from file: Hello, file handling in C!

In this example, the program writes a string to example.txt and then reads it back.

---

(2) Explain with example: pointer to structure

A pointer to a structure is a variable that stores the address of a structure. Using pointers to
structures allows more efficient memory management, especially when passing large structures
to functions or when dynamically allocating memory for structures.

Syntax:

struct StructureName *pointer_name;

Accessing structure members via pointer:

pointer_name->member_name;

Example:

#include <stdio.h>

struct Student {
int rollNo;
char name[50];
};

int main() {
struct Student s1 = {101, "John Doe"};
struct Student *ptr = &s1; // Pointer to the structure

// Accessing structure members using pointer


printf("Roll Number: %d\n", ptr->rollNo);
printf("Name: %s\n", ptr->name);

return 0;
}

Output:

Roll Number: 101


Name: John Doe
In this example, a pointer ptr is used to store the address of the structure s1. The -> operator is
used to access the structure members through the pointer.

---

(3) What is dynamic programming? Explain giving example

Dynamic Programming (DP) is a technique used in computer science to solve problems by


breaking them down into simpler subproblems and storing the results of these subproblems to
avoid redundant computations. It is particularly useful for optimization problems where the
solution can be recursively defined.

Key concepts:

Overlapping subproblems: The problem can be broken down into subproblems that are solved
multiple times.

Optimal substructure: The optimal solution to the problem can be constructed from optimal
solutions to its subproblems.

Example: Fibonacci Sequence

The Fibonacci sequence is a classic example of a problem that can be efficiently solved using
dynamic programming.

The Fibonacci sequence is defined as:

F(n) = F(n-1) + F(n-2)

F(0) = 0, \quad F(1) = 1

Recursive approach (inefficient):

#include <stdio.h>

int fib(int n) {
if (n <= 1) {
return n;
}
return fib(n - 1) + fib(n - 2);
}

int main() {
int n = 10;
printf("Fibonacci number at position %d is: %d\n", n, fib(n));
return 0;
}

Output:

Fibonacci number at position 10 is: 55


In the above recursive method, the same calculations are repeated many times, leading to
inefficiency.

Dynamic Programming Approach:

#include <stdio.h>

int fib(int n) {
int dp[n+1];
dp[0] = 0;
dp[1] = 1;

for (int i = 2; i <= n; i++) {


dp[i] = dp[i - 1] + dp[i - 2]; // Store results to avoid recalculating
}
return dp[n];
}

int main() {
int n = 10;
printf("Fibonacci number at position %d is: %d\n", n, fib(n));
return 0;
}

Output:

Fibonacci number at position 10 is: 55

In this approach, we store the intermediate results in the dp array, avoiding redundant
calculations and improving performance.

---

(4) Explain the concept of pointer to pointer

A pointer to pointer is a variable that stores the address of another pointer. It allows indirect
manipulation of data through multiple levels of pointers.

Syntax:

data_type **pointer_name;

You can think of a pointer to pointer as a pointer that points to another pointer, which in turn
points to the actual data.

Example:

#include <stdio.h>

int main() {
int num = 10;
int *ptr = &num; // Pointer to integer
int **ptr2 = &ptr; // Pointer to pointer

printf("Value of num: %d\n", num); // Direct access


printf("Value of num via ptr: %d\n", *ptr); // Access via single pointer
printf("Value of num via ptr2: %d\n", **ptr2); // Access via pointer to pointer

return 0;
}

Output:

Value of num: 10
Value of num via ptr: 10
Value of num via ptr2: 10

ptr is a pointer to num, and ptr2 is a pointer to ptr. Through ptr2, we can access num indirectly via
multiple levels of pointers.

---

You might also like