Why is the code below functioning. According to me it MUST
NOT.
Answer / h0rryp0tter
Please have a look at the code below :
char str[1];
int i = 0;
void revstr(void);
int main(void)
{
revstr();
printf("%s\n",str);
return 0;
}
void revstr(void)
{
char c = getchar();
if (c!= EOF) {
revstr();
str[i++] = c;
}
str[i] = '\0';
}
Written using Bloodshed Dev C++.
I am trying to access and write on an char array which has
been defined with only one element in it. The above code
must give me Errors of some kind. But on the contrary, it
works.
Is This Answer Correct ? | 0 Yes | 1 No |
WHAT IS LOW LEVEL LANGUAGE?
Why c language?
1.)how to find d most repeated word in a string? string ="how do you do"?? output should be do
1 Answers AAS, Nagarro, Vuram,
. Explain the differences between fork() and exec() in C
What is difference between Structure and Unions?
How the C program can be compiled?
12344321 123 321 12 21 1 1 how i print this program??
5 Answers DSR Management, Winit,
what will be the output of this program........ main() { int a=2,b=4,c=6; printf("%d"); } why it gives the value of third variable.
Please write me a program to print the first 50 prime numbers (NOT between the range 1 -50)
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
swap 2 numbers without using third variable?
main() { char as[] = "\\0\0"; int i = 0; do{ switch( as[i++]) {case '\\' : printf("A"); break; case 0 : printf("B"); break; default : printf("C"); break; }} while(i<3); }
4 Answers Vector, Vector India,