When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
7 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
!debugger
@still roost
Have you tried stepping through your code line by line in a debugger?
If you don't know how to use a debugger or don't have one set up, we highly recommend taking the time to do so.
Debuggers are immensely helpful tools for figuring out where problems emerge in code and especially when you're first learning it can help you build intuition and understanding for reasoning through code.
Resources:
@still roost
Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.
!solved
Thank you and let us know if you have any more questions!
This thread is now set to auto-hide after an hour of inactivity
#include <stdlib.h>
#include <stdio.h>
#define SIZE_MAX 100
void print_tab(size_t n, const int *arr) {
for (size_t i = 0; i < n; ++i) {
printf("%zu->%d\t",i+1 ,arr[i]);
}
}
int main() {
size_t n = 0;
int x;
int array[SIZE_MAX];
while ( scanf("%d", &x) != EOF) {
array[n] = x;
++n;
}
if (ferror(stdin)){
return EXIT_FAILURE;
}
print_tab(n, array);
return EXIT_SUCCESS;
}