Wikipedia

Hasil penelusuran

Sabtu, 05 Desember 2015

Summary.

1. When is the right time to use :

a. Struct
b. Pointer
c. Function
d. Array

2.  Write an Example That uses Combination of the above!


 Answer:

a. A structure is another user defined data type available in C that allows to combine data items of different kinds. Structures are used to represent a record. whenever we want to create a new data type, struct is the correct way to use.

b.A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before using it to store any variable address. whenever we want to change the value of a variable using the address, 
pointer is the correct way to use.

c.A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions.whenever we want to create a certain instruction separated from the main() , function is the correct way to use.

d. An Array is a kind of data structure that can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type. whenever we want to create a storage of variable, 
array is the correct way to use.

2.


and one with pointer :




 source : www.tutorialspoint.com