C15 Assignment

  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View C15 Assignment as PDF for free.

More details

  • Words: 361
  • Pages: 7
C Revision Questions Predict the output obtained

1. main() { int i=5,j; j=++i+++i+++i; printf("%d %d",i,j); } 2. main() { int i=1; i=2+2*i++; printf("%d",i); } 3. main() { int a=2,b=7,c=10; c=a==b; printf("%d",c); } 4. main() { int x; x=10,20,30; printf("%d",x); } 5. main() { int a; a=015 + 0x71 +5; printf("%d",a); } 6. main() { int a=2;

a=a++ + ~++a; printf("%d",a); } 7. main() { int a; a=sizeof(!5.6); printf(“%d”,a); } 8. main() { float a; (int)a= 45; printf(“%d”,a); } 9. main() { int i=5; int a=++i + ++i + ++i; printf(“%d”,a); } 10.main() { char a[5]; a[0]='q'; a[1]='u'; a[2]='e'; clrscr(); printf("%s",a); getch(); } 11.main() { clrscr(); printf("%d",sizeof(3.8)); getch(); } 12.main() { char *str1="powla"; char *str2="er";

clrscr(); printf("%s\b\b%s",str1,str2); getch(); } 13.main() { int a=270; char *p; p=(char *)&a; clrscr(); printf("%d",*p); getch(); } 14.main() { int far *a=(int far*)0x50000011; int far *b=(int far*)0x50010001; int huge *c=(int huge*)0x50000011; int huge *d=(int huge*)0x50010001; clrscr(); if(a==b) printf("I know C"); else printf("I don't know C"); if(c==d) printf("\nI know C"); else printf("\nI don't know C"); getch(); } 15.#define power(a) #a main() { clrscr(); printf("%d",*power(432)); getch(); } 16.main() { int arr[]={1,2,3,4,5,6}; void xxx(int[5]); xxx(arr);

getch(); } void xxx(int ch[5]) { clrscr(); printf("%d",-1[ch]); } 17.#define MAN(x,y) (x)>(y)?(x):(y) main() { int i=10,j=9,k=0; k=MAN(i++,++j); printf("%d %d %d",i,j,k); getch(); } 18.#define CUBE(x) (x*x*x) #define M 5 #define N M+1 #define PRINT printf("RITESH"); void main() { int volume =CUBE(3+2); clrscr(); printf("%d %d ",volume,N); PRINT getch(); } 19.#define max 10+2 void main() { int i; i=max*max; clrscr(); printf("%d",i); getch(); } 19.#define A 4-2 #define B 3-1 void main() { int ratio=A/B; printf("%d ",ratio);

getch(); } 20.main() { struct field { int a; char b; }bit; struct field bit1={5,'A'}; char *p=&bit1; *p=45; clrscr(); printf("\n%d",bit1.a); getch(); }

21.main() { int a=320; char *ptr; ptr=(char *)&a; clrscr(); printf("%d ",*ptr); getch(); } 23. #include"stdio.h" #include"conio.h" main() {

void (*p)(); int (*q)(); int (*r)(); p=clrscr; q=getch; r=puts; (*p)(); (*r)("Accy rocks the world"); (*q)(); } 24. main() { int i=3; int *j; int **k; j=&i; k=&j; printf(“%u %u %d ”,k,*k,**k); } 25. #include"stdio.h" #include"string.h" main() { register a=25; int far *p; p=&a; clrscr();

printf("%d ",*p); getch(); } 26. #include"stdio.h" #include"string.h" void main() { int a=5,b=10,c; int *p=&a,*q=&b; c=p-q; clrscr(); printf("%d",c); getch(); }

Related Documents

C15 Assignment
October 2019 21
C15
November 2019 46
C15
June 2020 17
C15
November 2019 20
C15-2008
November 2019 20
C15-2
October 2019 19