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 |
Difference between macros and inline functions? Can a function be forced as inline?
0 Answers HAL, Honeywell, Zomato,
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
What is volatile c?
What is the size of enum in bytes?
Write a C program in Fibonacci series.
What is a pointer on a pointer in c programming language?
What is the difference between procedural and declarative language?
String concatenation
what is diognisis?
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
what is the meaning of 'c' language
What is volatile keyword in c?