Okay, so this code compiled fine:
#include <stdio.h>
int main() {
int date[] = {20091005};
Type: Posts; User: guitarscn
Okay, so this code compiled fine:
#include <stdio.h>
int main() {
int date[] = {20091005};
Okay I just realized 20091005 is just a really big number 20,091,005. Even if I change that data type to 'unsigned double long' or something I guess it wouldn't make a difference but I still don't...
I'm learning C and have a question about this code:
#include <stdio.h>
int main() {
char date[] = "20091005";
I'm using the 5th edition published by Sams. The author is Stephen Prata (same as yours except this is a newer edition) (year 2005).
Well I am aiming to teach myself all the languages I want, with the help of some forums as well, of course. But I'll be picking up books on C, Perl, Python, Lisp, Java, HTML, PHP, and maybe some...
Wow, that's pretty nifty! (It worked flawlessly btw).
At this point I'm not sure if it's my lack of knowledge or the ability to think outside the box, but I wish I could have thought of that!
...
Hmmm...this is what I could get
#include <stdio.h>
#include <string.h>
int main(void)
{
int line = 0; /* start at the first array slot */
Here is what I have so far:
#include <stdio.h>
#include <string.h>
int main(void)
{
int line = 0; /* start at array block 1 */
I am pretty satisfied with the way the original solution came out - but NeonBlack did make a suggestion that I try to follow the instructions in the beginning, which I did not follow to get my...
Ah, these chapters have not yet covered 'if' and 'else' stuff yet. :( Also definitely not covered strchr and not even stdin either, I think. I know what NULL is so that's fine even though the book...
This is the best I could come up with:
#include <stdio.h>
#include <string.h>
int main(void)
{
The book didn't say anything about ^ or getline yet, so those weren't really an option I guess (yet). I was thinking of reading through the entire book, then going through the entire book again (and...
Yea, someone earlier was talking about pointers and malloc or something so that probably wouldn't limit it to 255 chars like this one. But thanks, at least the problem is now solved. This isn't that...
I had a similar issue, tri-booting BSD, Linux, and Windows. Because BSD does not use MBR partitions to boot since it uses disklabel as well as wanting to be within the first 8 GB of the hard drive,...
So is this okay for the code?
#include <stdio.h>
#include <string.h>
int main(void)
{
int letters;
Has anyone here taught themselves a programming language or multiple programming languages, all by themselves? Meaning no prior education on the topic, no school/classes in the field...just reading...
I've found that multiple books on teaching C don't really make a difference because all of them teach the same basic things...of course anyone would probably already know that (I didn't :( ) but even...
I'm reading the book in order, and I've already done most of the questions with the exception of a few like these. I'm pretty sure after reading chapter 6, that the reader should be able to do the...
"//you can't declare an array like this. you either hard code it ( display[255] ), or you research pointers and learn how to use malloc."
1st comment: Ah, no wonder. malloc is in the very last...
As you can probably tell, I'm pretty new at this (about 24 hours into learning C) so I'm trying very hard to understand from what I already know of the language.
I was trying to make scanf take...
I am reading the book C Primer Plus, the 5th edition, in order and I'm at the end of chapter 6 where they have some review questions. I'm having trouble with this question:
For the "line of...