[go: up one dir, main page]

0% found this document useful (0 votes)
14 views17 pages

New Microsoft Office Word Document

The document covers various fundamental concepts in C programming, including memory types, programming language levels, storage classes, and operators. It also explains recursion, control flow statements, pointers, and string handling functions, providing examples and code snippets for clarity. Additionally, it addresses common programming errors and concepts such as typecasting, command-line arguments, and multi-dimensional arrays.

Uploaded by

deep32817
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)
14 views17 pages

New Microsoft Office Word Document

The document covers various fundamental concepts in C programming, including memory types, programming language levels, storage classes, and operators. It also explains recursion, control flow statements, pointers, and string handling functions, providing examples and code snippets for clarity. Additionally, it addresses common programming errors and concepts such as typecasting, command-line arguments, and multi-dimensional arrays.

Uploaded by

deep32817
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/ 17

GROUP A

1. Differentiate between primary and secondary memory.


o Primary memory (main memory) is directly accessible by the CPU for executing
instructions and storing data that the CPU actively needs. It is typically volatile
(data is lost when power is off) and faster than secondary memory. Examples
include RAM.
o Secondary memory is used for long-term storage of data and programs not
currently in use by the CPU. It is non-volatile (data persists even when power is
off) and slower than primary memory. Examples include hard disks, SSDs, and
USB drives.
2. Differentiate between high-level and low-level programming languages.
o High-level languages are designed to be easier for humans to read and write. They
use abstractions and are closer to human language. They need to be translated into
machine code by compilers or interpreters. Examples include C, Java, Python.
o Low-level languages are closer to machine code, providing little to no abstraction.
They are harder for humans to read and write but offer more control over
hardware. Examples include assembly language.
3. Describe the various storage classes?
o Storage classes in C define the scope, lifetime, and visibility of variables and
functions. The main storage classes are:
 auto: The default storage class for local variables declared inside a
function or block. Their scope is limited to the block they are defined in,
and they exist only as long as the block is executed.
 register: Suggests to the compiler to store the variable in a CPU register
for faster access. However, the compiler may choose to ignore this.
 static: Variables retain their value between function calls or within their
scope. For variables inside a function, they are initialized only once and
keep their value between calls. For global variables, they are only
accessible within the file they are declared.
 extern: Used to declare a global variable that is defined in another file. It
tells the compiler that the variable exists elsewhere.
4. Describe the ternary operator with an example.
o The ternary operator is a shorthand way of writing an if-else statement. It has
the syntax: condition ? expression_if_true : expression_if_false;
o Example: int max = (a > b) ? a : b; This assigns the larger of a and b to
max.
5. What will be the output of the following program segments?
o The code has errors. x+y=z; is not a valid assignment. The correct assignment
would be z = x + y;. Also, y is not declared. If we correct these errors and
assume y is 10, the output would be 15.
6. What are bitwise operators in C? Give an example.
o Bitwise operators perform operations on individual bits of data. Examples
include:
 & (Bitwise AND)
 | (Bitwise OR)
 ^ (Bitwise XOR)
 << (Left shift)
 >> (Right shift)
 ~ (Bitwise NOT)
o Example: int a = 5; // 00000101 in binary, int b = 3; // 00000011
in binary, int c = a & b; // c will be 1 (00000001)
7. Explain the use of the sizeof operator with an example.
o The sizeof operator returns the size (in bytes) of a variable or data type.
o Example: int x; printf("%zu", sizeof(x)); // Output will be 4 (or
the size of an integer on that system) printf("%zu", sizeof(int));
// Output will be 4 (or the size of an integer)
8. What is recursion? Give a simple example.
o Recursion is a programming technique where a function calls itself, either directly
or indirectly.
o Example (Factorial):

int factorial(int n) {
if (n == 0) {
return 1;
} else {
return n * factorial(n - 1);
}
}
``` [cite: 5]

9. Write the syntax of a for loop and explain with an example.


o Syntax: for (initialization; condition; update) { // code to be
executed }
o initialization: Executed once at the beginning (e.g., int i = 0;).
o condition: Evaluated before each iteration. The loop continues as long as it's
true (e.g., i < 10;).
o update: Executed at the end of each iteration (e.g., i++).
o Example:

for (int i = 0; i < 5; i++) {


printf("%d ", i); // Output: 0 1 2 3 4
}
``` [cite: 6]

10. Explain the difference between break and continue.


o break: Immediately terminates the loop (or switch statement) and transfers
control to the statement following the loop.
o continue: Skips the rest of the current iteration of the loop and proceeds to the
next iteration.
11. Write a program segment to swap two integers using pointers.

void swap(int *a, int *b) {


int temp = *a;
*a = *b;
*b = temp;
}

int main() {
int x = 5, y = 10;
swap(&x, &y);
printf("x = %d, y = %d", x, y); // Output: x = 10, y = 5
return 0;
}
``` [cite: 7]

12. Convert the number (7CB4.FABE)16 to the Decimal number system.


o 7 * 16^3 + 12 * 16^2 + 11 * 16^1 + 4 * 16^0 + 15 * 16^-1 + 10 * 16^-2 + 11 *
16^-3 + 14 * 16^-4 = 31924.98821
13. What is typecasting? Give an example.
o Typecasting is converting a variable from one data type to another.
o Example: float avg = (float)sum / count; This casts sum to a float to
ensure floating-point division.
14. What are enumerated types?
o Enumerated types (enums) create a set of named integer constants, making the
code more readable.
o Example: enum Days {Sun, Mon, Tue, Wed, Thu, Fri, Sat};
15. Define const and volatile keywords in C.
o const: Declares that a variable's value cannot be changed after initialization.
o volatile: Indicates that a variable's value might be changed by external factors
(e.g., hardware), so the compiler should not optimize accesses to it.
16. Explain command-line arguments with syntax.
o Command-line arguments are values passed to a program when it is executed
from the command line.
o Syntax: int main(int argc, char *argv[])
 argc: Argument count (number of arguments).
 argv: Argument vector (array of strings containing the arguments).
argv[0] is the program name.
17. What is meant by a dangling pointer?
o A dangling pointer is a pointer that points to a memory location that has been
freed or deallocated. Accessing a dangling pointer leads to undefined behavior.
18. Convert the number (286.25)10 to the octal number system.
o 286 in octal is 436.
o 0.25 in octal is 0.2
o Therefore, (286.25)10 = (436.2)8
19. Find the error in the following code, if any, and explain the output:
o The error is that the printf statement is inside the if block, and the if condition
will never be false, but the loop never ends. Thus, "Im Sita" will never be printed.

20. Find the error in the following code, if any, and identify the output:
o The condition N == 4 will never be true because N is 3. Thus, "equal" will not be
printed, and there is no output.
21. Find the output of the following code
o The loop will terminate when val is 26. The final printf will print 28.

GROUP B

1. Write a program to evaluate the following using a recursive function:


o C
o #include <stdio.h>
o #include <math.h>
o
o double factorial(int n) {
o if (n == 0) return 1;
o return n * factorial(n - 1);
o }
o
o double f(double x, int n) {
o if (n == 0) return x;
o return f(x, n - 1) + pow(-1, n) * pow(x, 2 * n + 1) /
factorial(2 * n + 1);
o }
o
o int main() {
o double x;
o int n;
o printf("Enter x and n: ");
o scanf("%lf %d", &x, &n);
o printf("Result: %lf\n", f(x, n));
o return 0;
o }
o ``` [cite: 13]
o
2. What are void pointers? Explain the difference between null and void pointers.
o A void pointer is a pointer that can point to any data type. It is a generic pointer.
o A null pointer is a pointer that does not point to any memory location. It is used to
indicate that a pointer is not currently valid.
o A void pointer points to data of an unknown type, while a null pointer points to
nothing.
3. Write a C program to reverse a 1D array using pointers (no indexing).
o C
o #include <stdio.h>
o
o void reverseArray(int *arr, int size) {
o int *start = arr;
o int *end = arr + size - 1;
o while (start < end) {
o int temp = *start;
o *start = *end;
o *end = temp;
o start++;
o end--;
o }
o }
o
o int main() {
o int arr[] = {1, 2, 3, 4, 5};
o int size = sizeof(arr) / sizeof(arr[0]);
o reverseArray(arr, size);
o for (int i = 0; i < size; i++) {
o printf("%d ", arr[i]); // Output: 5 4 3 2 1
o }
o return 0;
o }
o ``` [cite: 14]
o
4. Write a program to find GCD using a recursive function.
o C
o #include <stdio.h>
o
o int gcd(int a, int b) {
o if (b == 0) return a;
o return gcd(b, a % b);
o }
o
o int main() {
o int a, b;
o printf("Enter two numbers: ");
o scanf("%d %d", &a, &b);
o printf("GCD: %d\n", gcd(a, b));
o return 0;
o }
o ``` [cite: 15]
o
5. Write a program to implement the following diagram using a for loop.

#include <stdio.h>

int main() {
int rows = 5;
for (int i = 1; i <= rows; i++) {
for (int j = 1; j <= 2 * i - 1; j++) {
printf("*");
}
printf("\n");
}
return 0;
}
``` [cite: 16]
6. Explain the use of multi-dimensional arrays.
o Multi-dimensional arrays are used to store data in a table-like structure with rows
and columns. They are useful for representing matrices, images, and other data
that has inherent multi-dimensionality.
7. Write the output:
o a) Output: 101 101
o b) Output: 28
8. What are pre-processor directives? Differentiate between macro and function with
necessary examples.
o Pre-processor directives are instructions to the compiler that are processed before
compilation. They start with #.
o Macros are code fragments that are replaced by their value before compilation
using #define. They are simple text substitutions.
o Functions are blocks of code that perform a specific task. They are called during
program execution.
o Example:
 Macro: #define PI 3.14159
 Function:

float area(float radius) {


return PI * radius * radius;
}
``` [cite: 18]

9. Write a program to sort an array in ascending order using pointers.


o C
o #include <stdio.h>
o
o void sortArray(int *arr, int size) {
o for (int *i = arr; i < arr + size; i++) {
o for (int *j = i + 1; j < arr + size; j++) {
o if (*i > *j) {
o int temp = *i;
o *i = *j;
o *j = temp;
o }
o }
o }
o }
o
o int main() {
o int arr[] = {5, 2, 8, 1, 9};
o int size = sizeof(arr) / sizeof(arr[0]);
o sortArray(arr, size);
o for (int i = 0; i < size; i++) {
o printf("%d ", arr[i]); // Output: 1 2 5 8 9
o }
o return 0;
o }
o ``` [cite: 19]
o
10. Write a program to count vowels and consonants in a string.
o C
o #include <stdio.h>
o #include <string.h>
o #include <ctype.h>
o
o int main() {
o char str[100];
o printf("Enter a string: ");
o fgets(str, sizeof(str), stdin); // Use fgets to safely read
input
o int vowels = 0, consonants = 0;
o for (int i = 0; str[i] != '\0'; i++) {
o char ch = tolower(str[i]);
o if (isalpha(ch)) {
o if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' ||
ch == 'u') {
o vowels++;
o } else {
o consonants++;
o }
o }
o }
o printf("Vowels: %d, Consonants: %d\n", vowels, consonants);
o return 0;
o }
o ``` [cite: 20]
o
11. Compute the address of marks[18][4] in a 20x5 array stored in row-major order.
Base = 1000, word size = 2
o Address = Base + (row * number of columns + column) * word size
o Address = 1000 + (18 * 5 + 4) * 2 = 1000 + (90 + 4) * 2 = 1000 + 188 = 1188
12. Describe string. Explain any three-string handling functions with examples.
o A string is a sequence of characters terminated by a null character ('\0'). In C,
strings are

Sources and related content

12. Describe string. Explain any three-string handling functions with examples.

<!-- end list -->

* A string is a sequence of characters terminated by a null character


('\\0'). In C, strings are represented as arrays of characters.
* Here are three common string handling functions:
* `strlen(str)`: Calculates the length of the string (excluding the null
terminator).
```c
#include <stdio.h>
#include <string.h>
int main() {
char myString[] = "Hello";
int length = strlen(myString);
printf("Length: %d\n", length); // Output: Length: 5
return 0;
}
```
* `strcpy(dest, src)`: Copies the string `src` to the string `dest`.
```c
#include <stdio.h>
#include <string.h>
int main() {
char source[] = "World";
char destination[10];
strcpy(destination, source);
printf("Destination: %s\n", destination); // Output: Destination:
World
return 0;
}
```
* `strcat(dest, src)`: Appends the string `src` to the end of the string
`dest`.
```c
#include <stdio.h>
#include <string.h>
int main() {
char str1[] = "Hello, ";
char str2[] = "World!";
strcat(str1, str2);
printf("Result: %s\n", str1); // Output: Result: Hello, World!
return 0;
}
```

13. Differentiate between (Any two): * a) Primary and secondary storage


o Already answered in Group A, question 1. * b) High-level and low-level
Programming Language
o Already answered in Group A, question 2. * c) Compilers and interpreters
o Compilers translate the entire source code into machine code at once, creating an
executable file. This executable file can then be run directly by the computer.
Examples: C, C++.
o Interpreters execute the source code line by line. They read a statement, execute
it, and then proceed to the next statement. Examples: Python, JavaScript.

GROUP C

1. (i) Write a C program to implement a function that reverses a given 1D matrix of


integers in-place, using only pointers (no array indexing allowed).

C
#include <stdio.h>

void reverseArray(int *arr, int size) {


int *start = arr;
int *end = arr + size - 1;
while (start < end) {
int temp = *start;
*start = *end;

*end = temp; start++; end--; } }

int main() {
int arr[] = {1, 2, 3, 4, 5};
int size = 5;
reverseArray(arr, size);
int *ptr = arr;
printf("Reversed array: ");
for (int i = 0; i < size; i++) {
printf("%d ", *ptr);
ptr++;
}
printf("\n");
return 0;
}
```

**(ii) Write a C program that demonstrates the behavior of all four storage
classes (auto, register, static, and extern) by printing their values across
multiple function calls and files.**

```c
// file1.c
#include <stdio.h>

void demo();
extern int ext_var; // Declaration

int main() {
printf("Inside main function\n");
demo();
demo();
demo();
printf("Value of extern variable is %d\n", ext_var);
return 0;
}

void demo() {
auto int auto_var = 0;
static int static_var = 0;
register int reg_var = 0;

auto_var++;
static_var++;
reg_var++;
printf("auto = %d, static = %d, register = %d\n", auto_var, static_var,
reg_var);
}

// file2.c
int ext_var = 10; // Definition
```

2. Compare and contrast dynamic memory allocation using malloc() and static
memory allocation for arrays in C. Discuss the advantages and limitations of each
approach with respect to flexibility, memory usage, and execution time.
o Static Memory Allocation:
 Memory is allocated at compile time.
 Size of the array must be known at compile time.
 Fixed size; cannot be changed during program execution.
 Faster than dynamic allocation because memory allocation is done
beforehand.
 Less flexible; can lead to memory wastage if the actual usage is less than
the allocated size, or memory overflow if the usage exceeds the size.
o Dynamic Memory Allocation:
 Memory is allocated at runtime using functions like malloc(), calloc(),
realloc().
 Size of memory can be determined during program execution.
 More flexible; memory can be allocated or deallocated as needed.
 Slower than static allocation due to the overhead of function calls and
memory management.
 More efficient memory usage; memory is allocated only when needed and
can be freed when no longer required. Requires careful memory
management to avoid memory leaks.
3. What is a function? Describe different function prototypes. Write a program to
calculate the sum of squares of the first n even numbers.
o A function is a block of code that performs a specific task. It can be called
multiple times from different parts of the program, promoting code reusability.
o Function Prototype: A function prototype declares the function before it is
defined. It specifies the function's return type, name, and the types of its
parameters.
 Syntax: return_type function_name(parameter_list);
 Examples:
 int add(int a, int b);
 void printMessage(char *message);
 double calculateArea(double radius);

<!-- end list -->

#include <stdio.h>
int sumOfSquaresOfEven(int n) {
int sum = 0;
for (int i = 1; i <= n; i++) {
int even = 2 * i;
sum += even * even;
}
return sum;
}

int main() {
int n;
printf("Enter the value of n: ");
scanf("%d", &n);
printf("Sum of squares of first %d even numbers: %d\n", n,
sumOfSquaresOfEven(n));
return 0;
}

GROUP C (continued)

4. (i) How is the multi-dimensional array useful?

Multi-dimensional arrays are useful for representing data that has more than one
dimension. This is common in various applications, including:

o Representing Tables and Matrices: They can directly model tables of data (like
spreadsheets) or mathematical matrices used in linear algebra. Each element is
accessed by its row and column index.
o Image Processing: Images can be represented as 2D arrays where each element
(pixel) stores color information. For color images, a 3D array might be used
(height, width, color channels).
o Game Boards: Games like chess or tic-tac-toe can use 2D arrays to represent the
game board state.
o Storing Coordinate Systems: In graphics and simulations, multi-dimensional
arrays can store coordinates of objects in 2D or 3D space.
o Data Analysis: They can be used to store and manipulate datasets with multiple
features or variables.

(ii) Consider a 20times5 two-dimensional array marks which has a base address
=1000 and the number of words per memory location of the array =2. Now compute
the address of the element marks[18][4] assuming that the elements are stored in
row-major order.

In row-major order, elements of a row are stored contiguously, followed by the next row,
and so on. For a 2D array arr[R][C] where R is the number of rows and C is the number
of columns, the address of arr[i][j] in row-major order is calculated as:

Address(arr[i][j]) = Base Address + (i * C + j) * Size of each element


In this case:

o Base Address = 1000


o Number of rows (R) = 20
o Number of columns (C) = 5
o We want to find the address of marks[18][4], so i = 18 and j = 4.
o Size of each element = number of words per memory location = 2

Plugging these values into the formula:

Address(marks[18][4]) = 1000 + (18 * 5 + 4) * 2


= 1000 + (90 + 4) * 2
= 1000 + (94) * 2
= 1000 + 188
= 1188

Therefore, the address of marks[18][4] is 1188.

(iii) Write a program to find the largest of n numbers using an array.

#include <stdio.h>

int main() {
int n;

printf("Enter the number of elements: ");


scanf("%d", &n);

if (n <= 0) {
printf("Please enter a positive number of elements.\n");
return 1;
}

int numbers[n];
printf("Enter %d numbers:\n", n);
for (int i = 0; i < n; i++) {
scanf("%d", &numbers[i]);
}

int largest = numbers[0]; // Assume the first element is the largest

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


if (numbers[i] > largest) {
largest = numbers[i];
}
}

printf("The largest number is: %d\n", largest);

return 0;
}
5. Discuss dynamic memory allocation functions with examples.

Dynamic memory allocation functions in C allow you to allocate and deallocate memory
during the program's runtime. The primary functions for this are found in the
<stdlib.h> header file:

o malloc(size_t size):
 Allocates a block of size bytes of memory.
 Returns a pointer of type void* to the allocated memory. You need to cast
this pointer to the appropriate data type.
 The allocated memory is not initialized (contains garbage values).
 Returns NULL if the allocation fails (e.g., not enough memory).

<!-- end list -->

#include <stdio.h>
#include <stdlib.h>

int main() {
int n;
printf("Enter the number of integers to allocate: ");
scanf("%d", &n);

int *arr = (int*) malloc(n * sizeof(int));

if (arr == NULL) {
printf("Memory allocation failed!\n");
return 1;
}

printf("Memory allocated successfully.\n");


for (int i = 0; i < n; i++) {
arr[i] = i + 1;
printf("%d ", arr[i]);
}
printf("\n");

free(arr); // Deallocate the memory when done


return 0;
}

o calloc(size_t num, size_t size):


 Allocates memory for an array of num elements, where each element is
size bytes.
 Returns a pointer of type void* to the allocated memory.
 The allocated memory is initialized to zero.
 Returns NULL if the allocation fails.

<!-- end list -->


C

#include <stdio.h>
#include <stdlib.h>

int main() {
int n;
printf("Enter the number of integers to allocate: ");
scanf("%d", &n);

int *arr = (int*) calloc(n, sizeof(int));

if (arr == NULL) {
printf("Memory allocation failed!\n");
return 1;
}

printf("Memory allocated and initialized to zero:\n");


for (int i = 0; i < n; i++) {
printf("%d ", arr[i]);
}
printf("\n");

free(arr);
return 0;
}

o realloc(void *ptr, size_t new_size):


 Resizes a previously allocated block of memory pointed to by ptr to
new_size bytes.
 It may move the allocated block to a new location if the current block
cannot be resized in place.
 If ptr is NULL, it behaves like malloc(new_size).
 If new_size is 0 and ptr is not NULL, it behaves like free(ptr).
 Returns a pointer of type void* to the reallocated memory. It's crucial to
update your original pointer with the return value of realloc() as the
memory location might have changed.
 Returns NULL if the reallocation fails.

<!-- end list -->

#include <stdio.h>
#include <stdlib.h>

int main() {
int *arr = (int*) malloc(5 * sizeof(int));
if (arr == NULL) {
printf("Memory allocation failed!\n");
return 1;
}
printf("Initial allocation of 5 integers.\n");

int *new_arr = (int*) realloc(arr, 10 * sizeof(int));


if (new_arr == NULL) {
printf("Memory reallocation failed!\n");
free(arr); // Free the original if reallocation fails
return 1;
}
arr = new_arr; // Update the pointer

printf("Reallocated to 10 integers.\n");
for (int i = 5; i < 10; i++) {
arr[i] = (i + 1) * 10;
printf("%d ", arr[i]);
}
printf("\n");

free(arr);
return 0;
}

6. Compare malloc(), calloc(), realloc(), and free().

| Feature | malloc() | calloc() | realloc() | free() | | ---------------- | ---------------------


--------------------- | ---------------------------------------------- | ------------------------------------
--------------------------------------- | --------------------------------------------- | | Purpose |
Allocate a block of memory. | Allocate an array of elements and initialize to zero. | Resize
a previously allocated block of memory. | Deallocate dynamically allocated memory. | |
Arguments | size_t size (size in bytes) | size_t num, size_t size (number and size
of elements) | void *ptr, size_t new_size (pointer to existing block, new size) | void
*ptr (pointer to the allocated block) | | Initialization | No initialization (contains
garbage). | Initializes all allocated bytes to zero. | Content of the original block is
preserved (up to the new size). New memory is uninitialized. | No return value. | | Return
Value | void* pointer to allocated memory, NULL on failure. | void* pointer to allocated
memory, NULL on failure. | void* pointer to the reallocated memory (may be a new
address), NULL on failure. | None. | | Use Cases | Single blocks of memory of a specific
size. | Allocating arrays where initialization to zero is needed. | Resizing dynamically
allocated arrays or blocks of memory. | Releasing memory that is no longer needed. |

7. Explain function call by value and call by reference with programs.


o Call by Value:
 When you pass arguments by value to a function, a copy of the actual
value of the argument is passed to the formal parameter of the function.
 Any changes made to the formal parameter inside the function do not
affect the original argument in the calling function.
 The function works with a local copy of the data.

<!-- end list -->

C
#include <stdio.h>

void modify(int x) {
printf("Inside modify: Before incrementing, x = %d\n", x);
x++;
printf("Inside modify: After incrementing, x = %d\n", x);
}

int main() {
int num = 10;
printf("Before function call, num = %d\n", num);
modify(num);
printf("After function call, num = %d\n", num);
return 0;
}
/* Output:
Before function call, num = 10
Inside modify: Before incrementing, x = 10
Inside modify: After incrementing, x = 11
After function call, num = 10
*/

o Call by Reference:
 When you pass arguments by reference (using pointers in C), the memory
address of the actual argument is passed to the formal parameter of the
function.
 The formal parameter (which is a pointer) now refers to the same memory
location as the original argument.
 Any changes made to the value pointed to by the formal parameter inside
the function do affect the original argument in the calling function.
 This allows functions to modify the original variables passed to them.

<!-- end list -->

#include <stdio.h>

void modifyByReference(int *x) {


printf("Inside modifyByReference: Before incrementing, *x =
%d\n", *x);
(*x)++; // Dereference the pointer to modify the value
printf("Inside modifyByReference: After incrementing, *x =
%d\n", *x);
}

int main() {
int num = 10;
printf("Before function call, num = %d\n", num);
modifyByReference(&num); // Pass the address of num
printf("After function call, num = %d\n", num);
return 0;
}
/* Output:
Before function call, num = 10
Inside modifyByReference: Before incrementing, *x = 10
Inside modifyByReference: After incrementing, *x = 11
After function call, num = 11
*/

You might also like