-->

Data file handling related program:

Data file handling related program:
--------------------------------------------------------------------------------------------------------------------
1)WAP to store data/character in a datafile.
     or
   program to understand  putc() to store data(one character).

                                                                                                                               solution

2)WAP to read data/character from opened file.
   or
program to understand getc() to read a character from opened file.

                                                                                                                                 solution
 
WAP to store data/character in an opened file then read that character and print on screen in same program.
                                                                                                                                    solution.

                                                                                                     

3)WAP to store  integers in  a data file.
                                                                                                                                solution                                        or
   WAp to read that stored integers in previuos qusetion(3).
                                                                                                                             solution

or
Program to understand getw() to read,and putw() to store a number in an opened file in same program.

                                                                                                                                 solution 

4)WAP to store and read data stored in a data file (q3) using fprintf() and fscanf() function.
                                                                                                                               solution

5)WAP to store  roll,name and percentage of some students in  a data file.
or
                                                                                                                              solution
WAP to  read roll,name and percentage of some students from a data file (previous question).
or
                                                                                                                            solution
WAP to store and read roll,name and percentage of some students to /from a data file using same program.
                                                                                                                            solution

.
6) program to store data (employee name and salary) in a data file using fwrite().

                                                                                                                         solution
 program to read data stored in a datafile and print on screen using fread().

                                                                                                                           solution
Write a program to write/store record and read from data file. THis data file contains employee name and salary. Use fread () and fwrite().

                                                                                                                             solution
7)Write a program to store book_id,book_name and book_price of some books to a data file until you say 'n'. Then same file displays all records.
                                                                                                                          solution

8) USe 'struct ' concept to store employee id,first name and salary to a data file until you say 'n'. Then display all those stored records.

                                                                                                                       solution
9)Program to understand remove() function.

                                                                                                                       solution

                                                                                                                       solution       
10)Program to understand rename() function.

                                                                                                                       solution
                                                                                                                     
                                                                                                                        solution
                                                                                                                     
11) Program to understand ftell() function.

                                                                                                                      solution
12)Program to understand fseek() function.

                                                                                                                     solution
13)Program to understand rewind() function.

                                                                                                                     solution

Pointer programs:

Pointer programs:

1)WAP to show use of pointer.
                                                                                                                              solution

2)WAP to show a character pointer

                                                                                                                               solution
3)WAP to show pointer for increment and decrement operator.


                                                                                                                                solution
4)WAp to show sum of two numbers using pointer


                                                                                                                                solution
5)WAp to show difference of two numbers using pointer


                                                                                                                               solution
6)WAp to show use of pointer in multiplication and division.

                                                                                                                               solution
7)WAP to show comparison of pointers.

                                                                                                                            solution

8WAP to know array as pointer.

                                                                                                                           solution

                                                                                                                            solution

                                                                                                                           solution

                                                                                                                         solution



9)WAP to know array of pointers.

                                                                                                                           solution
                             
                                                                                                                       
10)WAP to understand call by value and call by address.

                                                                                                                            solution

11)WAP to input 20 numbers and pick the greatest one using pointer.

                                                                                                                            solution

                                                                                                                            solution


12)WAP to find factorial value of a number using pointer.

                                                                                                                            solution

13)WAP to swap two numbers using pointer.

                                                                                                                                solution

14)WAP to sort 10 numbers using pointer.
                                                                                                                                solution


                                                                                                                                 solution

15)WAP to search a number in given list of numbers.

                                                                                                                                   solution

16)WAP to find sum and average of 10 numbers using pointer.

                                                                                                                           solution

17)WAp to understand pointer's pointer.

                                                                                                                               solution

18)WAP to understand pointer passed to function.
       or
     WAP to pass array to function.

                                                                                                                                solution

 
   WAP to count total length of a string using pointer pass to function
       or
    program to pass string to function.
                                                                                                                               solution


WAP to reverse a string using pointer. Pass pointer to function.
or
Program to pass string to function.
                                                                                                                              solution


program to copy a string to another using pointer. Pass string as pointer.
 or
Pass string to function.

                                                                                                                                solution

19)WAP to count total number of vowels ,consonants,spaces in a string using pointer.

                                                                                                                                     solution


20) WAp to reverse a string using pointer.

                                                                                                                                    solution
                           
                                                                                                                                    solution


21) program to use 2d array/string to display address and values.

                                                                                                                                   solution

22)WAP/program to input elements of array and display them using pointer.

                                                                                                                                   solution

23)WAP to input a string and to print its address(character's) with its value.

                                                                                                                                solution

struct,typedef and union related program :

struct programs :
--------------------------------------------------------------------------------------------------------------------
1.)WAp to initialize data with struct.
                                                                                                                            solution

                                                                                                                             solution
2)WAP to input name,address and roll of a student and display that using struct.
                                                                                                                           solution

3)WAP to know total memory occupied by struct using size of struct concept.

                                                                                                                             solution

4)WAP to input name,address and roll number of some students using struct/ array of struct.

                                                                                                                            solution


5)WAP read 10 students data (roll, name,class and marks in 5 subjects) and display that using struct with percentage.

                                                                                                                                 solution

6)Write a program to input student's name, address and class. Now display that in sorted order on the basis of name.

                                                                                                                              solution

7)Program to understand concept of nested structure of struct.
                                                                                                                              solution

8)wap to find sum of two distances measured in feet and inch using function.
         (pass struct as parameter in function)

                                                                                                                              solution

9)program to add two times given in hrs,mm and ss using struct

                                                                                                                           solution

10)WAP to enter student id, student name and address for any 10 students. Then search a data and its location.

                                                                                                                             solution

union:-

1)Write a program to initialize union.
                                                                                                                        solution

2) Write a program show use of union.
                                                                                                                            solution

3)program to  show total bytes used by union ,using sizeof().

                                                                                                                          solution

enum data type:


1) program to know enum data type.
                                                                                                                      solution

                                                                              solution

2) program to understand enum using loop.

                                                                                                                    solution

typedef data type:


1) WAP to understand concept of typedef.

                                                                                                                     solution

2)WAP to understand typedef for struct.

                                                                                                                       solution

3)wap to find sum of two distances measured in feet and inch using function.

                                                                                                                      solution




Function related programs:

programs using function with no arguments and no return values.
click the link.
---------------------------------------------------------------------------------------------------------

1) WAP to get area of circle (pi*R*R) using user defined function circle().

                                                                                                                          solution

2)WAP to print greatest number between two numbers using function.

                                                                                                                           solution

3)WAP to print smallest number among three numbers using function.


                                                                                                                         solution

4)WAP to know a number is even or odd using function.

                                                                                                                      solution

5)WAP to know a number is positive or negative or zero using function.

                                                                                                                            solution

6)WAP to generate series 1,2,3,4,5,.............100 using function

                                                                                                                              solution

7)WAP to get sum of  1,2,3,4,5,.............100 using function.

                                                                                                                           solution

8)WAP to get factorial value of a number using function.

                                                                                                                          solution

9)WAP to get reverse of a number using function.

                                                                                                                         solution

10)WAP to get Fibonacci series 1,1,2,3,5,8,.... 20th term.

                                                                                                                        solution
11) WAp to know a number is prime or composite or not using function.

                                                                                                                        solution

12)WAP to get square root of a number using function.


                                                                                                                        solution

13)WAp to display all even numbers lying 1 and 200 using function.

                                                                                                                        solution

14)wap to print multiplication table of a number using function

                                                                                                                     solution
15)wap to find factorial value of a number using function.

                                                                                                                      solution

16)WAp to find value of y raised to x using function.

                                                                                                                     solution

17)WAP to get length of string using function

       
                                                                                                                   solution
18)Write a program to reverse a a string using function.

                                                                             solution 

Function types:-



Function with no arguments and no return values.






                                                                         

program to get area of circle using function named circle()

// program to get area of circle using function named circle()
#include<stdio.h>                      //header file
void circle();                              // function prototype/declaration with return type zero.
int main()                                  //main function
{
circle();                                     // function calling. you can call it as many as you want.
return 0;
}
void circle()                              // function body line ; also called function definition
{
 float radius;                            // variable declaration
float area;                                //variable declaration
printf("enter radius of circle\n");   // displays message to input data
scanf("%f",&radius);                   // gets data from user.
area=3.14*radius*radius;             // calculates result stores in area.
printf("the area is=%f\n",area);    // displays output
}
/* here we have used top down approach. i.e calling from top and writing its body line down.
 we can also reverse the process.*/

-----------------------------------------------------------------------------------------------------------------------
or
--------------------------------------------------------------------------------------------------

// program to get area of circle using function named circle(). we use here bottom up technique
#include<stdio.h>                      //header file
                                              // function prototype/declaration is not needed
void circle()                              // function body line/definition
{
 float radius;                            // variable declaration
float area;                                //variable declaration
printf("enter radius of circle\n");   // displays message to input data
scanf("%f",&radius);                   // gets data from user.
area=3.14*radius*radius;             // calculates result stores in area.
printf("the area is=%f\n",area);    // displays output
}
int main()                                  //main function
{
circle();                                     // function calling. you can call it as many as you want.
return 0;
}
// this (above method is now obsolete. if you want that you can use that. mostly we use top down.


wap to initialize strings and display them

using codeblock
-----------------------------------------------------------------------------------
// initialization of strings
#include <stdio.h>                                   // header file

int main()                                               // main function
{
    char strings[5][5]={"RAM","sita","Hary","Niraj"};// initialization of 4 strings with 2 dimensional array
    int i;                                                               // variable declaration
    for(i=0;i<=3;i++)                                          // loop which executes 4 times because we have taken 4 strings so.
    {
        printf("%s\n",strings[i]);                              //display of strings
    }
    return 0;                                                      // return statement
}

-----------------------------------------------
using turboc++
-------------------------------------
// initialization of strings
#include <stdio.h>                                   // header file
#include<conio.h>
void main()                                               // main function
{
    char strings[5][5]={"RAM","sita","Hary","Niraj"};
// initialization of 4 strings with 2 dimensional array
    int i;                                                               // variable declaration
    for(i=0;i<=3;i++)                     // loop which executes 4 times because we have taken 4 strings so.
    {
        printf("%s\n",strings[i]);                              //display of strings
    }
    getch();                                                      // to hold the output.
}

array with string programs

1) wap to initialize strings and display them.

                                                                                                               solution
2) WAP to initialize some characters and display them.
                                                                                                              solution

3)WAP  to input any five names with address and display them.

                                                                                                            solution



programs strings with library functions (in-built functions)


1) WAP to get /find length of string using(strlen()) function.

                                                                                                           solution
2)WAP to reverse a string using strrev() function.

                                                                                                         solution

3)WAP to convert string into uppercase using strupr() function.

                                                                                                            solution

4)WAP to convert string into lowercase using strlwr() function

                                                                                                            solution

5)WAP to copy a string using strcpy().

                                                                                                            solution
6) WAP to concatenate /merge two strings using strcat() function.

                                                                                                             solution
7)WAP to compare two strings using strcmp() function.

                                                                                                            solution

8) wap to look for a specific character in given string using strchr() function.


                                                                                                         solution

9)WAP to set all characters in the given string to the character using strset() function.

                                                                                                         solution
10)WAP to find initial segment of string that consists entirely of characters from second string. using strspn() function.
                                                                                                       solution

11)WAP to scan first string for the first occurrence of the substring  in string second using strstr() function.
                                                                                                     solution           

12)WAP to search a string in given list of strings.

                                                                                                     solution

without using library functions:

1) WAP to find length of string without strlen() function.

                                                                                                    solution
2)WAp to reverse a string without using strrev function().

                                                                                                     solution
3) WAP to convert given string into uppercase without using strupr() function.

                                                                                                  solution

4) WAP to convert given string into lowercase without using strlwr() function.

                                                                                                 solution

5)WAP to copy a string without using strcpy().

                                                                                                            solution
6) WAP to concatenate /merge two strings without using strcat() function.

                                                                                                             solution



combined programs:

1) Write a program to sort 'n' strings. (ascending order or descending order).


                                                                                                                          solution
2) WAP to search a  string from a set of strings.

                                                                                                                             solution
3) WAP to know a string is Palindrome or not.

                                                                                                                         solution

4) WAP swap two strings.
                                                                                                                          solution

5) WAP to count total number of vowels in a string.

                                                                                                                          solution
6)WAP to count total number of consonants in a sting.

                                                                                                                          solution
7)WAP to count total words in a string.

                                                                                                                          solution
8) WAP to count particular character in a string.

                                                                                                                         solution

9) WAP to count total spaces in a string.

                                                                                                                          solution

10)WAP to count total digits present in a string.

                                                                                                                        solution
11)WAP to replace all white spaces with a character.

                                                                                                                       solution

12)WAP to count all characters after first white space.

                                                                                                                       solution
13)WAP to print all characters before the first space.

                                                                                                                        solution