0% found this document useful (0 votes)
32 views

Assignment 4

This document outlines 12 programming assignments involving pointers in C. The assignments include using pointers to: 1) compute the sum of array elements, 2) find the length of a string, 3) print an array in reverse order, 4) find the smallest element in an array, 5) copy one array to another, 6) print an array and find the maximum, 7) swap two numbers with a bitwise operation, 8) swap two arrays, 9) return the last two characters of a string reversed and separated by a space, 10) swap two pointers using a pointer to a pointer, 11) swap the lower and upper 16 bits of a 32-bit integer, and 12) return the number repeated an odd number of

Uploaded by

Esmail Mahmoud
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Assignment 4

This document outlines 12 programming assignments involving pointers in C. The assignments include using pointers to: 1) compute the sum of array elements, 2) find the length of a string, 3) print an array in reverse order, 4) find the smallest element in an array, 5) copy one array to another, 6) print an array and find the maximum, 7) swap two numbers with a bitwise operation, 8) swap two arrays, 9) return the last two characters of a string reversed and separated by a space, 10) swap two pointers using a pointer to a pointer, 11) swap the lower and upper 16 bits of a 32-bit integer, and 12) return the number repeated an odd number of

Uploaded by

Esmail Mahmoud
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment 4:

(1) C Program to compute sum of the array elements using


pointers.

(2) C Program to find length of a given string using pointer.

(3)C Program to read 10 integers into an array from user


and print them in reversing order using pointers.

(4) C function to get the value of the smallest element in


array using pointers.

(5) C function to copy all elements of an array into another


array using pointers. The two arrays have the same length
and types.

(6) C Program to print all the array elements and the


maximum number in array using array of pointers.

(7) C function to swap two numbers using bitwise


operation and call it using pointer to function.

(8) Write a C function to swap the contents of two arrays


with the same length using pointers.
(9) Given a string, create a new string made up of its last
two letters, reversed and separated by a space, the word
is “bat”. Return string contains ”t a”

(10) Write a c function two SWAP two pointers.


Hint: use pointer to pointer as a function argument.

(11) Write a c program that SWAP the value of the two 16-
bits of 32-bits integer number.

(12) Array that contains integer values, some of these


values are repeated with an even number of repetitions,
and only one value is repeated with an odd number of
repetitions. Write a C function that’s take the array as
input and the array size and return the number which has
odd numbers of repetitions.

Thanks and Good Luck


Eng / Mohamed Tarek

You might also like