That helps a lot. I need this simple language to help me understand it. Thanks whiteflags
Type: Posts; User: Kurtanius21
That helps a lot. I need this simple language to help me understand it. Thanks whiteflags
I'm trying to comprehend what is going on in the following code. I know it takes pointers and allocates memory, but varying use of stars and need for a loop is throwing me off. This code is correct....
In response to your statement, is that why the following is ok to do?
Say I've declared a variable
int variable;
Say I want to pass it into a function, whose prototype is
Is my understanding correct for Your **char example C99tutorial?12346
12346
So **S points to pointers, and each *S is a pointer. But what do *S point to exactly? Do they point to the base...
I'm going over a practice final. I don't understand a malloc line in the sample code. The code is supposed to read rooms of a household specifications (area, room type, and number of windows)....
Wow! It works if I add the display(stringA) after the display(stringB)! I really don't have any idea why! Anyone care to explain how this thing works? I really want to understand recursion, not just...
I'm trying to follow your suggestion stahta. I'm still having trouble. I'm trying to implement the replace_first_x() function as you suggested. Here's what I got
int replace_first_x( char...
The instructor said there is no need for malloc.
Do you think you could elaborate further Salem? An if statement would get me first x, then how do I create two recursions, one for the 0, and...
Here's the problem description:
“Write a recursive function that displays all the binary (base 2) numbers represented by a string of xs, 0s, and 1s. The xs represent digits that can be either 0 or...
I got it to work! I just had use strtok to eliminate the space chars in the arrays. End thread!
Something is killing my fgets input. Once the program encounters the element with a space, I replaces the first letter with \000
Apparently some of my elements in my arrays have spaces at the end of the subject. How can I get around this issue? I need the subject entered by the user (without the space) to match the array...
gdb shows me that the variable stri loses its subject string when j = 47. I'm confused.
My program isn't working properly. This is the weirdest thing ever. Here is my function:
void find_subject( int **crns, char ***subjects, char ***courses,
int *count )
{
char input[4],...
That did it! Thank you click here!
Also, flush isnt working for me. I get the same old problem if I enter the code. Endless prompts and never a chance to enter the subject.
printf("Please enter a subject: ");
fflush (stdout);...
So now I've got a new problem. I've adjusted my code according to a FAQ. It is now
void find_subject( int **crns, char ***subjects, char ***courses,
int *count )
{
char input[4], str[4];...
Uhh, I'm totally flabbergasted by your answer. What is stdout? I don't have any stdout in my code. What do you mean by flushing? I have never heard of the function fflush. Should I just type that...
I'm creating a simple function that reads three letters. The problem is, gdb shows me that the printf inquiry occurs after all the fgets and suggested newline elimination loops. Here's what gdb says...
That worked! thanks!
So if I add to the while loop check condition
while ( i < count - 1 )
I get the value 8. But 9 exists at the end of the array. gdb showed that. How can I get the 9 to print?
I entered in your suggested modification Whiteflags. Least gives me zero. It works. Most is still faulty. here's what gdb reads.
37 if ( ar[i] > *most )
1: *most = 9
(gdb) s
38 ...
I'm not giving the pointers something to point to at line 29? If that's not the case, doesn't malloc give the pointers something to point to?
Using gdb, I know the while loop kills my pointer value when the check condition is no longer true. Why is this, and how can I remedy this? My main function just prints 124231523 124323232. Main btw,...
I'm having so much trouble grasping pointers. I'm experimenting with pointers and I expect to ask several questions on this thread. My first confusion is notation.
I've gotten over declarations at...