Saturday, September 12, 2009

quantum paper

main()
{
int c=5,a=4;
clrscr();
printf("%d%d",main||c,main||a);
getch();
}

output: 11


(2).storage class and their types?

C has a concept of 'Storage classes' which are used to define the scope (visability) and life time of variables and/or functions.

storage classes is important part of c language.WHENEVER we define any funtion in c program then we can call that in every definend class.

there are four types of storage class. these are...

1 AUTO OR AUTOMATIC STORAGE CLASS

2 REGISTER STORAGE CLASS

3 STATIC STORAGE CLASS

4 EXTERNALSTORAGE CLASS

1) The features of "AUTOMETIC" storage class are as under some conditions:

storage : storage will be in memory.

value : garbage value.

scope : scope is local to block to the variable.

life : till, controls remain within the block.

2) The featurs of "STATIC" storage class are as under some conditions:

storage : memory.

value : zero.

scope : local to block.

life : Till control remains within the block.

3) The featurs of "REGISTER" storage class are as under some conditions:

storage : register.

value : garbage value.

scope : local to the block.

life : value persists between variable.

4) The feature of "EXTERNAL" storage class are as under some conditions:

storage : memory.

value : zero.

scope : local to block.

life : till controls remains within the block

(3).how can open the image file in c?

In C, generally we?can open files having text format...

other types of files can be opened in binary format only using

file *fp;

fp=fopen("filename","rb+");// where b stands for binary format

(4).
#include
main()
{
clrscr();
printf("%d",i);
getch();

}
int i=10;

output:

Error Undefined symbol 'i' in function main

(5).syntax for fwrite,fopen,fread,fseek


fwrite(const void *buffer, size_t size, size_t count, FILE *stream);

fread( void *buffer, size_t size, size_t num, FILE *stream );

fseek( FILE *stream, long offset, int origin );

fopen(const char *FileName, const char *Mode);

(6).how to find string length wihtout using c function?

#include<stdio.h>
#include<conio.h>
int str_len(char *)
void main()
{
char s[30];
int count;
printf("enter the string :");
gets(s);
count=str_len(s);
printf("the length is :%d",count);
getch();
}
int str_len(char *a)
{
int i=0;
while(*a!='\0')
a++;
i++;
}
return i;
}

(7).
main()
{

char s[]={'a','b','c','\0','a'};
char *p;
p=&s[3];
char *s1;
s1=s;
printf("%d",++(*p)+ ++(*str1));
getch();

}error: cant giving input through array to pointer..
pointer to array is possible in c.

(8).
#include
#include
struct set
{
int x;
char name[];
}set;

main()
{
set.x=3;
set.name[]={"hi"};
printf("%d%d",set.x,set.name);
getch();

}

output:
error ..because name declared as a char..but we use string .

(9)& (10)..
two question from header files error. like "sddio." and "cionio.h"

(11).main()
{
int i=300;
int j=400;
clrscr();
printf("%d %d");
getch();
}



OUTPUT:


300 400

No comments:

Post a Comment