C Programming and Technical Programming Output

Q. What is the output of the following program?

void main(){
int a=1;
while(a++ <= 1)
while(a++ <= 2);
printf("%d",a);
}

Read Solution (Total 23)

C Other Question

write a function Power2 which returns the nearest power of 2 of the number being passed. What will the following program do?
void main()
{
int i;
char a[]="String";
char *p="New Sring";
char *Temp;
Temp=a;
a=malloc(strlen(p) + 1);
strcpy(a,p); //Line number:9//
p = malloc(strlen(Temp) + 1);
strcpy(p,Temp);
printf("(%s, %s)",a,p);
free(p);
free(a);
} //Line number 15//
a) Swap contents of p & a and print:(New string, string)
b) Generate compilation error in line number 8
c) Generate compilation error in line number 5
d) Generate compilation error in line number 7
e) Generate compilation error in line number 1