0% found this document useful (0 votes)
33 views1 page

Assign 2 3 Sem

The document provides examples of C programming concepts including: 1) Printing the size of different variable types using sizeof. 2) Macro definitions and their expansion. 3) Dynamically allocating memory for an array at runtime and calculating the sum and average. 4) Stating the differences between calloc and malloc memory allocation functions. 5) Examples of operations on matrices including summing two matrices, finding the transpose, and summing the diagonals.

Uploaded by

api-3831824
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views1 page

Assign 2 3 Sem

The document provides examples of C programming concepts including: 1) Printing the size of different variable types using sizeof. 2) Macro definitions and their expansion. 3) Dynamically allocating memory for an array at runtime and calculating the sum and average. 4) Stating the differences between calloc and malloc memory allocation functions. 5) Examples of operations on matrices including summing two matrices, finding the transpose, and summing the diagonals.

Uploaded by

api-3831824
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Contact no.

9836608046
ENCODING
The quest for c, c++, c#, data structure, java, unix and many more ends here

1) void main( )
{
int i = 5; float m = 4.5 ;
printf(“ %d %d %d %d %d”, sizeof(i), sizeof( i++), size (++i), sizeof(m), sizeof(m++));
}

2) void main( )
{
Printf(“%d %d %d %d %d”, sizeof(3.5f) , sizeof(“3”) , sizeof(‘3’), sizeof(3.5),
sizeof(sizeof(3.5)));
}

3) #define p(x) x + x * x + x
#define q(x) x * x
#define r(x) q(x) * x
#define s(x) (x * x)
Void main ( )
{
int a , b , c , d , e = 5;
a = p(e) ; b = q(e) + q(e) ; c= r(e) + r(e) ; d = s(++e) ;
printf( “%d %d %d %d”,a , b , c, d);
}

4) WAP to find the sum and average of numbers in the array and the size of the array will be
mentioned at the run time.( use dynamic memory allocation ).
5) State the differences between calloc and malloc.
6) WAP to find the sum of two matrices after taking them as input.
7) WAP to find the transpose of a matrix.
8) WAP to find the sum of the diagonals of a matrix.
9) WAP to find the maximum and minimum element of an array. Take the array as input in
main( ) and pass it to the function named maximum( ) and minimum( ) to do the
respective task.
10) WAP to merge two array into a single array.
11) WAP to insert an element in the array. Take the position to be inserted as input.

You might also like