What will be output of following c program?

			  		

Loading

Practice Arrays – What will be output of following c program?


int main ()
{
int i = 2;
twice (2);
printf ("%d", i);
}
twice (int i)
{
print ("Inside");
}
int i, b[] = {1, 2, 3, 4, 5}, *p;
p = b;
++*p;
p += 2;

What is the value of *p;

*A + 1 – *A + 3

Loading

Practice Arrays – *A + 1 – *A + 3

&A[5] – &A[1]?

Loading

Practice Arrays – &A[5] – &A[1]?

Declare the following statement ?



“An Array

Loading

Practice Arrays – Declare the following statement ?

“An Array of three pointers to chars”

What will be output of the following “c” code?

Loading

Practice Arrays – What will be output of the following “c” code?


#include
void main()
{
int i, a[50]={1,2,3,4,5};
for( i=0; i<5; i++)
printf("%d",*a++);
}

What will be output of the following “c” code?

Loading

Practice Arrays – What will be output of the following “c” code?


#include
void main()
{
int c[]={2.8,3.4,4,6.7,5};
int j, *p=c, *q=c;
for(j=0; j<5; j++)
{
printf("%d", *c);
++q;
}
for(j=0; j<5; j++)
{
printf("%d", *p);
++p;
}
}

Point out the error in the following program on GCC compiler.

Loading

Practice Arrays –

Point out the error in the following program on GCC compiler.

#include<stdio.h>  
int main() {
char str[] = "Logic World";
printf("%.3s %2s ", str, str);
return 0;
}

What is the output of the following program on GCC compiler?

Loading

Practice Arrays –

What is the output of the following program on GCC compiler?

#include<stdio.h>  
int main() {
int a[5] = {2, 3};
printf("%d, %d, %d ", a[2], a[3], a[4]);
return 0;
}

What will be the output of the following program on GCC compiler?

Loading

Practice Arrays –

What will be the output of the following program on GCC compiler?

#include <stdio.h>
void main(){
int arr[]={10,20,30,40,50};
int i, *k;
k = &arr[4]-4;
for(i=0; i<=4; i++){
printf("%d,",*k);
k++;
}
}

What will be the output of the program if the array begins at 65472

Loading

Practice Arrays –

What will be the output of the program if the array begins at 65472 and each integer occupies 4 bytes?

#include<stdio.h>    
int main() {
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0};
printf("%u, %u ", a+1, &a+1);
return 0;
}

 

What is the output of the following program on GCC compiler?

Loading

Practice Arrays –

What is the output of the following program on GCC compiler?

#include <stdio.h>
int main(){
int i,n=5;
int arr[5];
for(i=0;i<=5;i++)
printf("%d",arr[i]);
arr[n]=n=--n;
printf("%d %d %d",n,arr[4],arr[5]);
return 0;
}

#include<stdio.h>  
int ma

Loading

Practice Arrays –

#include<stdio.h>  
int main() {
int a[5] = {2, 3};
printf("%d, %d, %d ", a[2], a[3], a[4]);
return 0;
}