APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY Previous Years Question Paper & Answer

Course : B.Tech

Semester : S1 and S2

Year : 2018

Term : MARCH

Branch : BIOTECHNOLOGY

Scheme : 2015 Full Time

Course Code : CS 100

Page:7





PDF Text (Beta):

Enter a number:15
4 is composite

6 is composite

8 is composite

9 is composite

10 is composite

12 is composite
14 is composite

15 is composite

6.

In C++ all functions must be declared before they are used. This is accomplished usingfunction
prototype. Prototypes enable complier to provide stronger type checking. When prototype is
used, the compiler can find and report any illegal type conversions betweenthe type of
arguments used to call a function and the type definition of its parameters. Itcan also find the
difference between the no of arguments used to call a function and thenumber of parameters in
the function. Thus function prototypes help us trap bugs beforethey occur. In addition, they help
verify that your program is working correctly by notallowing functions to be called with
mismatched arguments.

‎general function prototype looks like following:return_type func_name(type‏ م
‎param_name1, type param_name2, ...,type param_nameN);The type indicates data type.‏
‎Parameter names are optional in prototype‏
‎Following program illustrates the value of function parameters‏

‎void sqr_it(int *i); //prototype of function sqr_itint
main()
{ int num;num = 10;

‎sqr_it(num); //type mismatchreturn 0;

‎}
‎void sqr_it(int *i)
{

‎ട്ട;
‎}

‎Since sqr_it() has pointer to integer as its parameter, the program throws an error whenwe pass
an integer to it.

‎ds
‎C Union is also like structure, i.e. collection of different data types which are grouped together.
Each element in a union is called member.

‎Union and structure in C are same in concepts, except allocating memory for their members.
Structure allocates storage space for all its members separately.
Whereas, Union allocates one common storage space for all its members

‎We can access only one member of union at a time. We can’t access all member values at the
same time in union. But, structure can access all member values at the same time. This is because,
Union allocates one common storage space for all its members. Where as Structure allocates
storage space for all its members separately.

‎Many union variables can be created in a program and memory will be allocated for each union
variable separately.

Similar Question Papers