0% found this document useful (0 votes)
19 views2 pages

Assignment

Uploaded by

piggu12341
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)
19 views2 pages

Assignment

Uploaded by

piggu12341
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/ 2

THE LNMIIT, Jaipur

Department of Computer Science & Engineering

Programme: B.Tech. Course Title: Programming for Problem Course Code:


( All Branches ) Solving Lab CSE104
Session: 2024-25
Type of Course: Core Prerequisites: NIL Total Contact
Hours: 30
Year/Semester: Lecture Tutorial Practical Credits: 4.5
1/1 Hrs./Week: 3 Hrs./Week: 0 Hrs./Week: 3

Lab
Assignments
hours
3
Assignment

Q1. Write a C program that swaps two numbers using pointers. The program should contain a
function void swap(int *a, int *b) that swaps the values of two integers using their pointers.

Q2. Write a C program that reverses an array of integers using pointers. Implement a function
void reverse_array(int *arr, int n) to reverse the elements of the array using pointer manipulation.

Q3. Write a C program that copies a string from one location to another using pointers.
Implement a function void copy_string(char *source, char *destination) that copies the contents
of the source string to the destination string using pointers.

Q4. Write a C program to access elements of a 2D array using pointers. Implement a function
void access_2d_array(int *arr, int rows, int cols) that prints the elements of a 2D array using
pointer arithmetic.

Q5. Write a C program to find the sum of all elements in a 2D matrix using pointers. Implement
a function int matrix_sum(int *matrix, int rows, int cols) that calculates the sum of the elements
using pointer arithmetic.

Q 6. Write a C program that removes all vowels from a string using pointers. Implement a
function void remove_vowels(char *str) that modifies the string in-place by removing all vowels
(a, e, i, o, u).

Q 7. Write a C program to find the first occurrence of a substring within another string using
pointers. Implement a function char *find_substring(char *str, char *substr) that returns a pointer
to the first occurrence of substr in str, or NULL if substr is not found.
THE LNMIIT, Jaipur
Department of Computer Science & Engineering

You might also like