Tuesday, 26 February 2013

C programs in Arrays,Pointers and Structures

1)
a) Write a C Program to find the LCM of two given numbers using Recursion
b) You are given two sorted arrays, A and B, and A has a large enough buffer at the end to hold B.
Write a Function to merge B into A in sorted order.
void merge(int a[], int b[]);

2)
a) Write a C Program to sort the characters in a given string in ascending order
b) Write a C Program to print each word in a string in reverse order
Example : Input :- KMIT Engineering College
Output :- TIMK gnireenignE egelloC
3)
a) Write a C Program to Sort a Set of Student Records based on the Student Name in Descending
Order. Using Functions and Pointers

The Structure of the Student should consist of Sno, Sname and Marks

Sample Input :- Enter Student Details (Sno,Sname,Smarks):- 100 Raju 95
Enter Student Details (Sno,Sname,Smarks):- 95 Hari 90
Enter Student Details (Sno,Sname,Smarks):- 97 Vasu 85
Enter Student Details (Sno,Sname,Smarks):- 94 Rajesh 99

Output:- 97 Vasu 85
100 Raju 95
94 Rajesh 99
95 Hari 90

b)Write a C Program to Search a Given Element in an Array Using Recursion

4)
a) Write the Code for the following function
int * allocateMemory(int *a,int size)
The function should allocate memory for the variable a based on the size.
Read the elements into the array , return it and display it in main function.
b) Write a Macro to Swap two numbers without using third variable

No comments:

Post a Comment