This is an additional tutorial composed with array for 1D, 2D and pointers. Please answer all questions and read carefully
This tutorial consists with 10 questions:
- Exercise 1
- Exercise 2
- Exercise 3
- Exercise 4
- Exercise 5
- Exercise 6
- Exercise 7
- Exercise 8
- Exercise 9
- Exercise 10
Try to complete this tutorial by commit your changes and read the question carefully 🚀
Using printf, display a string "I Love Programming!"
Using gets and printf, display a string "I am a Bachelor Degree Student from Universiti Malaysia Kelantan"
Using fgets and puts, display a string "Practice Makes Perfect!"
Write a program to find the summation of array elements as follow (note: use loop in this program):
num[] = {10.0, 22.5, 15.5, 32.5, 10.9, 67.9, 12.5, 11.9, 25.5, 100.0};
Write a program to display a string "Practice Makes Perfect!". Next, print 8-th element from the string as follow:
8-th element from the string is: _____
Write a program to display a multidimensional (2D) array as follow (note: use nested loop in this program as to read rows and columns):
Element at x[0][0]: 0
Element at x[0][1]: 2
Element at x[1][0]: 4
Element at x[1][1]: 6
Element at x[2][0]: 8
Element at x[2][1]: 10
Based from Exercise 4, write a program to calculate summation of array element by passing an array to a function (note: create a function name summationArray)
Based from Exercise 6, write a program to display a multidimensional (2D) array by passing an array to a function (note: create a function name displayElement)
Write a program to display the address each of element below: (note: use loop in this program)
myArray[] = {1,2,3,4,5};
Create pointer name ptr and assigned the address of this pointer to variable name myVariable where the value store in myVariable is 100. Next, print the address and value of ptr as follow:
Address for ptr is: ____
Value for ptr is: ____