Some of that is a little over my head but I will study the code and then try to implement it in my code. Thanks. I will try to get back to you with what my results are but that probably won't be...
Type: Posts; User: scrfix
Some of that is a little over my head but I will study the code and then try to implement it in my code. Thanks. I will try to get back to you with what my results are but that probably won't be...
So what you are telling me is that fgets is not the correct function to use here because people can obviously type more than what fgets expects and it doesn't just drop the excess text. I was told...
I have not tried compiling it with another OS other than GCC in the Linux environment. I kind of wanted to get it working first in the linux environment prior to compiling it in another environment.
Okay,
I will try that right now. Although I am not really sure how to implement that so I will have to figure out what this actually means. It looks like it has EOF which I understand to be End...
I have read 12.26a and already tried fflush(stdout) without success.
I had not read 12.26b and that was pretty interesting to know. Is that trying to tell me that there is nothing standardized that...
The title might be off because as a beginner that is what it appeared to me was happening. However the issue that is happening is still present.
I changed the malloc back to MAXNAME and that...
I originally had the MAXNAME in my code for the storage container however I through that perhaps since I was sending the stuff to a struct I need to allocate enough memory to store everything in the...
When I do that I get the following errors:
jharvard@appliance (~/Desktop/CS50/source code files): make ptr-strct
gcc -ggdb -std=c99 -Wall -Werror ptr-strct.c -lcrypt -lcs50 -lm -o ptr-strct...
I used to have that in there but I received the following errors which is why I had to go to the strcpy function.
ptr-strct.c:75:22: error: request for member 'fname' in something not a structure...
I have tried this is multiple places. In the struct I tried fname[MAXNAME+1]. This did not work. I tried in in the fgets function: fgets(storage,MAXNAME+1,stdin); and that didn't work.
...
It doesn't work. Here is what I did.
I updated the MAXNAME macro from 20 to 21.
I changed the removenewline function from changing the '\n' to 0 to change it to '\0'. This will ensure that...
It is automatically placed in there when I use fgets. I shouldn't need to add it. Is that not correct? I have actually also tried to update the removenew line to replace the \n with '\0' instead...
Hello,
My program actually works but has bugs in it and I don't know why the bugs are showing up.
Background
I am teaching myself how to program in C. I have been studying this for a while in...
You are exactly correct on two counts. I did forget to update the prototype. I had never seen that error before. My swap also did not work. I don't know what you mean by dereference. Any...
It gives me the errors when I just do that. I have tried the following:
gcc -ggdb -std=c99 -Wall -Werror -o fifteen fifteen.c -lcs50 -lm
fifteen.c: In function 'init':
fifteen.c:152:9: error:...
I have tried them however I only have a basic conception of pointers and was not able to get it to work. It kept telling me that I could send an integer argument without casting it as a pointer.
...
Hello,
I am working on a swap function with 2 dimensional arrays. I have it working if I write it as an If statement but cannot get it to work as a function.
It should basically initialize the...
This guy states he has been programming for either 10 or 18 years in his introduction videos. They are not the best videos but they are at such a beginner level that I have to make it harder myself...
I would agree if that were my sole source for learning. I am taking the Open Course Ware by Harvard for CS50 and Mobile phone programming. However in their video lectures they didn't explain items...
I do realize that those two lines of code are C++. I was just beginning video tutorials. In the video tutorials, the guy teaches you using dev c++ and has you save your .c files as .cpp files. It...
Thank you very much for that insight.
I read the Bridge Out Ahead in your signature and laughed... lol
I have taken both of your suggestions in to account and added more on to the program.
Thank...
Here is the revised code. This was merely for a project that I was working on for some video tutorials. The tutorials are stupidly easy so I am attempting to make them a little harder by added my...
I understand that numOfStudents could be a char over an int.
If I knew what the error meant I would listen to it however I have never seen that error before. Line 30 is the scanf("....
Just...
I have an error happening here.
1. I have attempted to write this function while I am learning C. It asks how many students and then asks for the age of each student.
2. In Windows after 4 ages...
okay, I rewrote it to:
#include <conio.h>
#include <iostream>
#include <ctype.h>
using namespace std;