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 down the program to sort the array.
What is return type in c?
What does char * * argv mean in c?
How many types of arrays are there in c?
Explain what is page thrashing?
Explain how do you declare an array that will hold more than 64kb of data?
What's the right way to use errno?
What is const keyword in c?
Do you know pointer in c?
There is a mobile keypad with numbers 0-9 and alphabets on it. take input of 7 keys and then form a word from the alphabets present on those keys.
how to swap 2 numbers in a single statement?
Which is best linux os?