Interesting idea. I will try this and see how it works out.
char menu(void)
{
char reply;
//char buf[BUFSIZ];
puts("\nEnter 1 for task A");
Type: Posts; User: ModeSix
Interesting idea. I will try this and see how it works out.
char menu(void)
{
char reply;
//char buf[BUFSIZ];
puts("\nEnter 1 for task A");
I finally realized what was happening, and found information about converting strings to integers.
Ended up using this code for my menu() function and it does the trick. Thanks for pointing me in...
While I appreciate the concise answer, could you point me towards what I need to look at in the FAQ, I've gone through a bunch of it and have no been able to find an answer that related to C, but I...
I am having a problem with a menu system, it's a sample menu system that I am putting together to make sure it will work, theoretical reasons, just trying to learn.
When an invalid value is...
So I have come up with the following method, since it's within the scope of what I have learned so far from my book. I am getting some strange output though.
/* concatenate two strings and...
I wasn't taking your source code and using it, but I didn't understand the logic behind it. So I came up with my own version of it as you can see in my latest posting.
Alright so the refined and working function to find string length is completed. Overall resulting in a much more compact program.
/* concatenate two strings and malloc() memory to store a...
While I am sure the function you provided works as intended, I don't understand the logic behind it.
I'm still working from a pretty basic knowledge pool and rather than just using an example I...
I've managed to get the allocation function and length calculations working properly, and yes I should probably break this into other functions, which I will do shortly.
I am going to have to...
I've refined the function and it's not producing errors, as well as allocating memory correctly. Now to concatenate the two strings together.
char link_array(char first[], char second[],...
I think I will attempt to do it both ways, because doing it the long way probably will teach me something I need to know down the road for another purpose.
Now onto my next question.
When...
Amazingly, that was exactly what was happening, after inputting the two strings, it would just do nothing, which I assume was a direct result of the infinite loop you spoke of.
I am probably going...
I haven't tried compiling it yet, as I hadn't written the concatenate function yet.
I'm writing it using Mac OSX XCode for my editor and it's showing warnings on a few lines, I'll compile it and...
I haven't learned those functions yet, I am working through the book Teach Yourself C in 21 days, and it takes a tutorial approach, this is an end of chapter exercise on working with basic string...
I am trying to concatenate two strings together into a third string array, and allocating memory to store the third string and return the pointer to it.
Here is what I have so far.
/*...
Thank you. Is there a way to discard any overflow?
Will this also work with a width modifier? ex: %80[^\n] ?
fgets is what I need. Having checked the FAQ it seems my answer is there.
Thanks.
For confirmation from the FAQ, please tell me if I am doing this correctly now:
char input[81];
When executing a simple program I created through tutorials I am working through I am told by my OS that using gets is unsafe.
Is there an alternative to it that will allow strings to be entered,...
Thanks guys. What each of you have said makes sense to me in different ways. I may just be overthinking pointers. I am going to go over the linked tutorial to see if that helps me with the concepts I...
On the topic of pointers, I'm going through a well written tutorial book, and I just finished the chapter on pointers, but I left only half satisfied with what I learned. Everything I've learned up...
I may or may not be right but you have
scanf("%d %d", &dub1, &dub2);
remove the & symbols and have it read
scanf("%d %d", dub1, dub2);
Wow, something so simple that I couldn't even see it.
Thanks for the help. :)
I am just learning C programming and and working through 'The C Programming Language' by Dennis Ritchie.
I am just starting to explore arrays and am working on a sample piece of code in the book...