Persistent
Company
Category
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;
}
Read Solution (Total 10)
-
- compilation error,since variable b is local to the main function
- 9 years agoHelpfull: Yes(5) No(4)
- 12345 will be the solution
- 10 years agoHelpfull: Yes(2) No(5)
- 2 Errors :As variable b is not defined in function func(int j,int *a)and staement printf(?%d?,a[i
]); is invalid.And one Warning as func(int j,int *a) is not returning anything. - 7 years agoHelpfull: Yes(2) No(0)
- Function does not return any value so output is original array..12345
- 8 years agoHelpfull: Yes(1) No(1)
- ERROR--Func need a protoype
- 9 years agoHelpfull: Yes(0) No(1)
- compilation error ,because 'b' is not declare in the function
- 8 years agoHelpfull: Yes(0) No(1)
- compilation error due to ?%d?
- 8 years agoHelpfull: Yes(0) No(1)
- Error :
1)‘b’ undeclared
2)expected expression before ‘?’ token - 8 years agoHelpfull: Yes(0) No(1)
- prog.cpp:1:11: error: '::main' must return 'int'
void main()
^
prog.cpp: In function 'int main()':
prog.cpp:5:12: error: 'func' was not declared in this scope
func(j,a[i]);
^
prog.cpp:7:8: error: expected primary-expression before '?' token
printf(?%d?,a[i]);
^
prog.cpp:7:9: error: expected primary-expression before '%' token
printf(?%d?,a[i]);
^
prog.cpp:7:10: error: 'd' was not declared in this scope
printf(?%d?,a[i]);
^
prog.cpp:7:12: error: expected primary-expression before ',' token
printf(?%d?,a[i]);
^
prog.cpp:7:17: error: expected ':' before ')' token
printf(?%d?,a[i]);
^
prog.cpp:7:17: error: expected primary-expression before ')' token
prog.cpp:7:17: error: expected ':' before ')' token
prog.cpp:7:17: error: expected primary-expression before ')' token
prog.cpp:7:17: error: 'printf' was not declared in this scope
prog.cpp: At global scope:
prog.cpp:9:18: error: ISO C++ forbids declaration of 'func' with no type [-fpermissive]
func(int j,int *a)
^
prog.cpp: In function 'int func(int, int*)':
prog.cpp:13:1: error: 'b' was not declared in this scope
b= b+2;
^ - 7 years agoHelpfull: Yes(0) No(0)
- 12345 ure chagig poninter adreess and not any values
- 6 years agoHelpfull: Yes(0) No(0)
Persistent Other Question
#include
func(char *s1,char * s2)
{
char *t;
t=s1;
s1=s2;
s2=t;
}
int main()
{
char *s1="jack", *s2="jill";
func(s1,s2);
printf("
%s
%s ",s1,s2);
return 0;
}
#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;
}