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 |
write a statement to display all the elements array M(in reverse order? int M[8]={20,21,22,23,24,25,26,27};
List some of the dynamic data structures in C?
Difference between C and Embedded C?
what are two categories of clint-server application development ?
What is build process in c?
How do I create a directory? How do I remove a directory (and its contents)?
What is volatile, register definition in C
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
What is the o/p of the follow pgm? #include<stdio.h> main() { char char_arr[5]=”ORACL”; char c=’E’; prinf(“%s\n”,strcat(char_arr,c)); } a:oracle b. oracl c.e d.none
What is difference between union and structure in c?
Why n++ execute faster than n+1 ?
Tell us the difference between these two : #include"stdio.h" #include<stdio.h> define in detial.