Tuesday 22 August 2017

Structure size without sizeof operator

Q : Write a ‘C’ program to find size of structure without using sizeof operator.

Solution :


#include<stdio.h>
typedef struct stu
{
     int roll;
     char name[20];

Monday 21 August 2017

Write A Line to File

Q: Write a ‘C’ program to write a line of string at a text file.

Solution : 


#include<stdio.h>
void main()
{
     FILE *pt;
     char ar[100];
     int i;
     printf("Enter the Text>> ");
     gets(ar);
     pt=fopen("test.txt","w");
     if(pt==NULL)
          puts("Unable to open file");
     else
     {
          for(i=0;ar[i]!='\0';i++)
               putc(ar[i],pt);
     }
     printf("\nData created successfully");
     fclose(pt);
    
}

Saturday 19 August 2017

Sorting C Language Keyword Program

Q : Write a ‘C’ program to list of keywords which must be sorted in increasing order in the table.

Solution : 


#include<stdio.h>
int power(int,int);
void main()
{

     char keyword[][15]={"char","do","extern","if","return","static","union","while","case","default","enum","goto","register","

Friday 18 August 2017

Disable Enable Datagrid column Editing

You can  disable to edit some column and make other read only from DataGridview in Windows Programming, For some special circumstances like on a shop sales bill editing . A user need to change product, quantity and rate but not Total . Total will be calculated by product of rate and quantity. If Total pr