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 |
can we have joblib in a proc ?
Can the curly brackets { } be used to enclose a single line of code?
When is an interface "good"?
What are high level languages like C and FORTRAN also known as?
What is a scope resolution operator in c?
How many data structures are there in c?
how to write a c program to print list of fruits in alpabetical order?
What is the use of the restrict keyword?
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
How many types of sorting are there in c?
sqrt(x+sqrt(x+sqrt(x+sqrt(x))))=2; Find the value of x?
Explain Basic concepts of C language?