What is function prototype?
Function prototype means the declaration of function.
It is declared in declaration section.
Like variable we have to declare the function before its use.
eg. void fun(int,int);
What is the disadvantages of “linked list” over “array”?
If we want to do little work and fixed length of list, so it would be better to use an array because using linked list it it would more time consuming than array.
This is the the main advantages of linked over array.
Can you explain why “LINKED KIST” is introduced in C language?
Because if we yse array for sequancial organization in that case one major problem occurs that size of an array must be specified precisely at begining so we can’t perform many work in real-life application.
Linked list is a compeletely different way to represent a list is to make each item in list of a structure and it also contains a “link” .
Using linked list we can work many task that we can’t do using array like delete or add a element in a list.
SO for this purpose “LINKED LIST” is introduced in C.
PROGRAMME TO PRINT FOLLOWINT
1
23
345
456
5678
6789
————————————————————————————————————————————————————————————–
#include<stdio.h>
#include<conio.h>
void main()
{
int i=3,j,k=5,n,cnt=0;
clrscr();
printf(“enter any number : “);
scanf(“%d”,&n);
printf(“%3d”,1);
printf(“\n%3d%3d\n”,2,3);
for(i=3;i<=n;i++)
{
for(j=i;j<=k+cnt;j++)
printf(“%3d”,j);
cnt++;
if(cnt%2==0)
{
k+=3;
cnt=0;
}
printf(“\n”);
}
getch();
}
Which functions are use to write in rendomly access file?
The functions are
-
fwrite();
-
fread();
A prog to print .c file without first comment line
//a prog to print the whole .c file with out first or other line which contain comment
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp;
char c;
int cnt=0;
clrscr();
fp=fopen(“prog.c”,”r”);
while((c=getc(fp))!=EOF)
{
if(c==’/')
cnt++;
if(c=getc(fp)==’/’)
cnt++;
if(cnt==2)
while((c=getc(fp))!=’\n’);
else
printf(“%c”,c);
fclose(fp);
getch();
}