Thank you I think I understand it now.
Type: Posts; User: Countfog
Thank you I think I understand it now.
Never mind, it works much better with sprintf(), but thanks. Concatenate means to join words together, and sprintf() does that as well.
I'm reading the section of my book on Variable Length argument list functions, and I can't quite understand, how the following program averages the numbers. An average is to add the values and to...
Yea that works, but this is in the chapter on string and character functions. It doesn't really concatenate them, so my professor might not be satisfied. I will try sprintf()
I have to write a program. Its basically a "random self book writer".
It uses random number generation to write sentences. It has 4 arrays of strings which are the databank for the words the...
Yep as you were posting this, I found a nice example of this in my book. Thanks. :)
This just prints hello though. What If I want to print "name"? Doesn't the pointer only point to the first element of the array?
#include <stdio.h>
int main( void )
{
char *words[] = {...
Cool I didn't know you could do that. Thats what I mean. What would I use to select each seperate word? Can you give me a sample printf statement with
char *words[] = { "hello", "my", "name",...
Nope you don't quite understand what I mean. Let me rephrase it.
I need a character array to hold about 10 words, and to have the ability to pick any of those 10 words and print them out...
Is it possible to do the following?
char s[] = " hello my name is john";
And then to print, not the entire sentence, but only "hello" and then on another line to print "name" and etc.
I'm...
In the code I provided in the zip file, I already have this prototype for a double linked list.
struct listNode {
char data;
struct listNode *nextPtr;
struct listNode *prevPtr;
Now lets...
Thanks a lot citizen, your explanation does make sense. There is one thing I probably still don't get about nodes themselves. Remember I have only my book to explain things to me, and you know how...
I'm telling you I can't stand online programming courses in college, but what choice do I have? I have no live instructor. Its very difficult.
I have an assignment. Convert a linked list to a...
Thanks a lot tabstop, I really do understand macros a lot more now. :D
Wow!!! So the macro is literally almost exactly like a function. The book does not stress this point enough, it doesn't explain that I can put the entire code of a similar function into the macro and...
Ok still having trouble.
Here is the function that sums up the values of an array.
int sum_array(int a[], int num_elements)
{
int i, sum=0;
for (i=0; i<num_elements; i++)
{
The reason why I think macros are different, is because they are predefined before the program begins, it makes one think that anything outside of main cant be used the same way.
Once again if I...
Ah youre right its so simple. (slaps self)
With all this confusion I forgot that I left x and y as abstract variables.
Yea here I fixed the code. Output is 117
#include <stdio.h>
#...
Hey, I'm new here.
I am in a C programming course in my college. Its an online course so sometimes I can't get the help I need. I don't recommend taking programming as an online course. One really...