Persistent
Company
Category
#include
int a[5] ={1,2,3,4,5},i,j=2,b;
func(int j,int *a)
{
j=j+1;
a=a+j;
b= b+2;
}
int main()
{
for (i =0;i<5;i++ )
func(j,a[i]);
for (i =0;i<5;i++ )
printf("%d",a[i]);
return 0;
}
Read Solution (Total 10)
-
- 12345
its only a code to print the array a[5], everything else this is only a distraction - 10 years agoHelpfull: Yes(27) No(6)
- compiler error a[i] is integer cannot be stored in pointer
- 10 years agoHelpfull: Yes(8) No(3)
- [Error] invalid conversion from 'int' to 'int*' in func(j,a[i])
- 9 years agoHelpfull: Yes(4) No(1)
- output: a[0]=4
a[1]=5,
a[2]=6,
a[3]=7,
a[4]=8 - 10 years agoHelpfull: Yes(1) No(11)
- 12345 because function is nor reurning anythng ..it simply prints elemnts of an array
- 9 years agoHelpfull: Yes(0) No(3)
- ERROR
because we require a pointer array for this scenario. - 9 years agoHelpfull: Yes(0) No(0)
- from integer to pointer conversion is by default... so no error and will print 1,2,3,4,5
- 8 years agoHelpfull: Yes(0) No(0)
- output of this question is- 1 2 3 4 5
- 8 years agoHelpfull: Yes(0) No(1)
- output is: 12345
- 7 years agoHelpfull: Yes(0) No(0)
- output will be 12345
- 7 years agoHelpfull: Yes(0) No(0)
Persistent Other Question
void main()
{
int a[5] ={1,2,3,4,5},i,j=2,b;
for (i =0;i<5;i++ )
func(j,a[i]);
for (i =0;i<5;i++ )
printf(?%d?,a[i]);
}
func(int j,int *a)
{
j=j+1;
a=a+j;
b= b+2;
}
If there are n proceses and each process waits p time in waiting state then cpu utilization is-: