Sure will cover it while teaching "Strings". Meanwhile you can watch this video technotip.com/9116/c-programming-arrays-pointers-functions/ and learn how arrays and pointers work. Please don't forget to subscribe to our UA-cam channel and blog. 👍
Because he want to find the position of the number he searched in the array. It can be written as just i only but as we don't start our count from zero so he increased i by one to know the position.
Write a program to reverse the strings stored in the following array of pointers to strings: char *s[ ] = { "To err is human...", "But to really mess things up...", "One needs to know C!!" } ; pls make a video on explaining this problem pls pls
please explain this //=========C program to print the all index of an element in an array=========== int AllIndexesRecursive (int input[], int size, int x, int output[]) { if (size == 0) return 0; int smallAns = AllIndexesRecursive (input + 1, size - 1, x, output); if (input[0] == x) { for (int i = smallAns - 1; i >= 0; i--) output[i + 1] = output[i] + 1; output[0] = 0; smallAns++; } else for (int i = smallAns - 1; i >= 0; i--) output[i] = output[i] + 1; return smallAns; } void aio (int a[], int size, int x) { int res[size]; int n = AllIndexesRecursive (a, size, x, res); for (int i = 0; i < n; i++) { printf ("%d ", res[i]); } } void main () { int a[5] = { 1, 2, 1, 1, 1 }; aio (a, 5, 1); return; }
you made it so easy to understand, that a quality. Thank you
Thanks man it really helped me bro❤
Happy to know that.
Great Job! Easy to understand though!
I tried this code but the statement prints several times... why?
bro pls make a video on (array of pointer to string) concept
its very confusing
Sure will cover it while teaching "Strings". Meanwhile you can watch this video technotip.com/9116/c-programming-arrays-pointers-functions/ and learn how arrays and pointers work. Please don't forget to subscribe to our UA-cam channel and blog. 👍
I don't understand why you used the scanf of the interger key underneath that printf
Without scanf how can you give the input
Thanks!
Why i +1 in printf
Because he want to find the position of the number he searched in the array.
It can be written as just i only but as we don't start our count from zero so he increased i by one to know the position.
Write a program to reverse the strings stored in the following array of pointers to strings:
char *s[ ] = {
"To err is human...",
"But to really mess things up...",
"One needs to know C!!"
} ;
pls make a video on explaining this problem pls pls
Will surely take this up when teaching about "Strings" bro. Kindly stay subscribed to our UA-cam channel and blog. 👍
please explain this
//=========C program to print the all index of an element in an array===========
int AllIndexesRecursive (int input[], int size, int x, int output[])
{
if (size == 0)
return 0;
int smallAns = AllIndexesRecursive (input + 1, size - 1, x, output);
if (input[0] == x)
{
for (int i = smallAns - 1; i >= 0; i--)
output[i + 1] = output[i] + 1;
output[0] = 0;
smallAns++;
}
else
for (int i = smallAns - 1; i >= 0; i--)
output[i] = output[i] + 1;
return smallAns;
}
void aio (int a[], int size, int x)
{
int res[size];
int n = AllIndexesRecursive (a, size, x, res);
for (int i = 0; i < n; i++)
{
printf ("%d ", res[i]);
}
}
void main ()
{
int a[5] = { 1, 2, 1, 1, 1 };
aio (a, 5, 1);
return;
}
Good but video is not clear enough
why is the final result not working for me?
for(i=0; i
Count should be used in if statement not in else statement
nice