C Programming :: Arrays - Discussion
Home > C Programming > Arrays > MCQs Questions Discussion
1 / 55
What is the output of the following problem ?
#include<stdio.h>
int main()
{
func(1);
return 0;
}
func(int i){
static char *str[] = {"One","Two", "Three", "Four"};
printf("%s\n",str[i++]);
return;
}
#include<stdio.h>
int main()
{
func(1);
return 0;
}
func(int i){
static char *str[] = {"One","Two", "Three", "Four"};
printf("%s\n",str[i++]);
return;
}
AOne
BTwo
CThree
Dwo
ESegmentation fault
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
TRICK
Here, in main() first func(1) will be called, since char is static in func(int i) after first increment it goes to another index i.e. "Two" so, it will get printed.
Read Full Answer
Report Error
Please Login First Click Here