I have a program that outputs a menu, the input should be a char from stdin. Naturally, I would think to use getchar(). Are you supposed to do the following every time after you are finished...
Type: Posts; User: albundy
I have a program that outputs a menu, the input should be a char from stdin. Naturally, I would think to use getchar(). Are you supposed to do the following every time after you are finished...
I think I just found the answer.
showgroup((const struct person * const *)pgroup, 10);
Perfect, thanks for the explanation! I have two more questions.
First, when I try to call the function, I get a warning:
warning: passing argument 1 of 'showgroup' from incompatible pointer...
I'm a little confused about how to use const. I have a struct person and I have an array of pointers to person structs. I want to have a showgroup() method that takes an array of pointers to...
I have something that works but I'm still not completely sure why my previous code did not. I think it is because you cannot change the pointer unless you pass a pointer to the pointer.
...
Thanks for the replies. I'm still caught up on this. In print_arrs, strs[i] is a pointer to char (the i'th string), correct? It seems I'm obviously wrong because swap_onetwo is complaining about...
I've been banging my head against the wall trying to figure out why this doesn't work. Isn't strs a pointer to a pointer of char? Any help would be appreciated. Thanks.
#include <stdio.h>...
Perfect, thanks for the quick reply! That is what I suspected but I couldn't find the answer.
I'm having a hard time understanding this short snippet of code. When you pass a pointer to a function and then use the postfix increment operator, why does the value of the pointer keep its...